Skip to content

Category Archives: Algorithms

Given an array of integers, find all combination of four elements in the array whose sum is equal to a given value X. For example, if… Read More
Given two signed integers, write a function that returns true if the signs of given integers are different, otherwise false. For example, the function should… Read More
You are given n pairs of numbers. In every pair, the first number is always smaller than the second number. A pair (c, d) can… Read More
Given a sequence of words, and a limit on the number of characters that can be put in one line (line width). Put line breaks… Read More
Given a function foo() that returns integers from 1 to 5 with equal probability, write a function that returns integers from 1 to 7 with… Read More
Deterministic Finite Automaton (DFA) can be used to check whether a number “num” is divisible by “k” or not. If the number is not divisible,… Read More
Write a function that calculates the day of the week for any particular date in the past or future. A typical application is to calculate… Read More
  Given a number n, print all primes smaller than or equal to n. It is also given that n is a small number.  Example: â€¦ Read More
Given an unsorted array and a number n, find if there exists a pair of elements in the array whose difference is n. Examples:  Input: arr[]… Read More
A magic square of order n is an arrangement of n2 numbers, usually distinct integers, in a square, such that the n numbers in all… Read More
Given a number n, write a function that returns count of numbers from 1 to n that don’t contain digit 3 in their decimal representation. Examples:  â€¦ Read More
Given three corner points of a triangle, and one more point P. Write a function to check whether P lies within the triangle or not.… Read More
Write a program to find sum of positive integers without using any operator. Only use of printf() is allowed. No other library function can be… Read More
Given a partially filled 9×9 2D array ‘grid[9][9]’, the goal is to assign digits (from 1 to 9) to the empty cells so that every… Read More
The partition problem is to determine whether a given set can be partitioned into two subsets such that the sum of elements in both subsets… Read More

Start Your Coding Journey Now!