Skip to content
W3colleges
W3colleges
  • Home
  • Algorithms
    • Analysis of Algorithms
    • Searching
    • Sorting
    • Divide and Conquer
    • Greedy
    • Dynamic Programming
    • Backtracking
    • Branch and Bound
    • Graph And Algorithms
    • Pattern Searching
    • Mathematical
    • Geometric
  • Data Structures
    • Array
    • Queue
    • Stack
    • Linked List
    • Binary Tree
    • Graph
    • Hashing
    • String
  • C Programming
    • Basic
    • Pointers
    • Operators
    • Control Statement
    • Loops
    • Function
    • Array
    • Sorting
    • Advanced
  • C++ Programming
    • C++ Basics
    • Operators
    • Control Statements
    • Functions
    • Array
    • Constuctor and Destructor
    • Overloading & overriding
    • C++ Library
    • STL
    • Misc
      • Object Oriented
      • Inhertiance
      • Sorting
      • Advanced
  • Programs
    • C Programs
    • C++ Programs
  • CS Core
    • Operating Systems
    • DBMS
    • Computer Networks
  • Interviews
  • Contests
  • Python

Find sum of all n digits which come in power of 2 of given number n

Problem: Given an integer ‘n’, find sum of all n digits which come in power of 2 of given number n. Examples: Input: p = 9 Output: 8 Explanation : 2^9 = 512 Digit sum : 5 + 1 + 2 = 8 Input: p = 48 Output: 73 Explanation : 2^48 = 281474976710656 Digit sum : 73… Read More »

Java Programs Mathematical

Print array as first element is first maximum and second element is first minimum and so on

Given an array of unique integers, print the array in such a way that the first element is first maximum and second element is first minimum and so on. We have to Rearrange an array in maximum minimum form using Two Pointer Technique. Examples: Input : arr[] = {7, 1, 2, 3, 4, 5, 6} Output : 7… Read More »

Arrays C++ Programs Dynamic Programming
Two-pointer

Efficient LRU Cache Implementation with get() and set() Methods

LRU cache implementation: Here we have two methods get and set which are defined as follows: get(x) : If the key x exists in the cache, returns its value and update reference position in the list. Else returns -1. set(x,y) : Inserts the value if the key x is not already present. If the cache reaches its capacity… Read More »

Analysis C++ Programs Hash Queue

Recent Posts

  • Four Pillars of Object-Oriented Programming (OOPS)
  • Minimize Difference Between Sum of Squares in Array Permutation
  • Find the occurrence of every element among all possible subarrays of the array
  • Compare Two Lists
  • Convert Number n to 1 in Minimum Steps
  • Generate All Distinct Subsequences of Length m from Numbers 1 to n with Repetitions
  • Default Parameters in Python Functions
  • Check if given string contains Even 1’s and Odd 0’s
  • Check if a Clique Can Be Divided into Two Equal Halves
  • Python Methods to Remove Spaces from Dictionary Values

Categories

  • Algorithms
  • Analysis
  • Arrays
  • Backtracking
  • Bit Magic
  • Blog
  • C
  • C Programs
  • C++
  • C++ Programs
  • Combinatorial
  • Compiler Design
  • Computer Networks
  • Computer Organization and Architecture
  • Data Structures
  • DBMS
  • Difference Between
  • Digital Logic
  • Divide and Conquer
  • Dynamic Programming
  • GATE CS
  • Git
  • Graph
  • Greedy
  • Hash
  • Heap
  • HTML
  • Internship
  • Interviews
  • Java
  • Java Programs
  • JavaScript
  • Linked List
  • Machine Learning
  • Mathematical
  • Matrix
  • Misc
  • MongoDB
  • MySQL
  • NoSQL
  • Operating Systems
  • Pattern Searching
  • Python
  • Python Programs
  • Queue
  • Recursion
  • Searching
  • Sorting
  • SQL
  • Stack
  • Strings
  • Tree
  • Web Technology

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
About Us | Contact | Feedback | Privacy Policy | Copyright
Sitemap