## Program to find remainder without using modulo or % operator

Given two numbers ‘num’ and ‘divisor’, find remainder when ‘num’ is divided by ‘divisor’. The use of modulo or % operator is not allowed. Examples… Read More »

- Must do Math for Competitive Programming
- Array of Vectors in C++ STL
- Breadth First Search without using Queue
- Minimize the maximum difference between adjacent elements in an array
- Shortest Path Faster Algorithm
- Basic Algorithm Techniques Not Taught in Academics
- Print all possible combinations of the string by replacing '$' with any other digit from the string
- Role of SemiColon in various Programming Languages
- Check if a string is a scrambled form of another string
- Word Break Problem | DP-32 | Set - 2
- Median of an unsorted array using Quick Select Algorithm
- Count the number of ways to construct the target string
- Sum of GCD of all possible sequences
- Maximum number of unique values in the array after performing given operations
- Extended Knapsack Problem
- Kth most frequent Character in a given String
- Count of substrings of length K with exactly K distinct characters
- Maximum LCM among all pairs (i, j) from the given Array
- Longest common subarray in the given two arrays
- Count of subarrays which start and end with the same element
- Huffman Coding using Priority Queue
- 0/1 Knapsack Problem to print all possible solutions
- Find if there is a path between two vertices in an undirected graph
- Find lexicographically smallest string in at most one swaps
- Finding Median of unsorted Array in linear time using C++ STL
- Flood Fill Algorithm
- What is a Webcrawler and where is it used?
- Operator Overloading '<<' and '>>' operator in a linked list class
- Shortest path in a directed graph by Dijkstra’s algorithm
- Why Prim’s and Kruskal's MST algorithm fails for Directed Graph?

Given two numbers ‘num’ and ‘divisor’, find remainder when ‘num’ is divided by ‘divisor’. The use of modulo or % operator is not allowed. Examples… Read More »

Given the mobile numeric keypad. You can only press buttons that are up, left, right or down to the current button. You are not allowed… Read More »

Amortized Analysis is used for algorithms where an occasional operation is very slow, but most of the other operations are faster. In Amortized Analysis, we… Read More »

Below is my interview experience with linkedin India for software development intern. First there was an online round on hackerrank where they asked 4 simple… Read More »

Given three arrays sorted in non-decreasing order, print all common elements in these arrays. Examples: Input: ar1[] = {1, 5, 10, 20, 40, 80} ar2[]… Read More »

Approach: 1. Put all input integers to hashmap’s key 2. Print keySet outside the loop Java filter_none edit close play_arrow link brightness_4 code import java.util.HashMap;… Read More »

Given an array of integers, find the first repeating element in it. We need to find the element that occurs more than once and whose… Read More »

Given a positive integer n, write a function to compute sum of the series 1/1! + 1/2! + .. + 1/n! A Simple Solution solution… Read More »

Given a positive integer n, print first k digits after point in value of 1/n. Your program should avoid overflow and floating point arithmetic. Examples… Read More »

Problem Statement: Given a text txt[0..n-1] and a pattern pat[0..m-1], write a function search(char pat[], char txt[]) that prints all occurrences of pat[] in txt[].… Read More »

Given a number n find the number of valid parentheses expressions of that length. Examples : Input: 2 Output: 1 There is only possible valid… Read More »

Given a natural number ‘n’, print squares of first n natural numbers without using *, / and -. Examples : Input: n = 5 Output:… Read More »

Given a directed and two vertices ‘u’ and ‘v’ in it, find shortest path from ‘u’ to ‘v’ with exactly k edges on the path.… Read More »

There are given n ropes of different lengths, we need to connect these ropes into one rope. The cost to connect two ropes is equal… Read More »

Generate all permutations of given length such that every permutation has more or equal 1’s than 0’s in all prefixes of the permutation. Examples: Input:… Read More »