# Category Archives: Algorithms

## Find position of an element in a sorted array of infinite numbers

Suppose you have a sorted array of infinite numbers, how would you search an element in the array? Source: Amazon Interview Experience. Since array is… Read More »

## Cisco Interview Experience | Set 9 (For Experienced)

Written Test: 1) 15 Aptitude Questions 2) 25 CS Fundamentals & Couple of output questions. 3) Coding Question: A thief trying to escape from a… Read More »

## Count number of ways to reach a given score in a game

Consider a game where a player can score 3 or 5 or 10 points in a move. Given a total score n, find number of… Read More »

## Find all distinct palindromic sub-strings of a given string

Given a string of lowercase ASCII characters, find all distinct continuous palindromic sub-strings of it. Examples: Input: str = “abaaa” Output: Below are 5 palindrome… Read More »

## An interesting time complexity question

What is the time complexity of following function fun()? filter_none edit close play_arrow link brightness_4 code int fun(int n) {         for (int i = 1;… Read More »

## Myntra Interview Experience | Set 3 (On-Campus)

Recently Myntra visited our campus for hiring full timers as well as interns . I would like to share my experience as a full time… Read More »

## Given a number n, count all multiples of 3 and/or 5 in set {1, 2, 3, … n}

Given a number n, count all multiples of 3 and/or 5 in set of numbers from 1 to n. Examples: Input: n = 6 Output:… Read More »

## Greedy Algorithm for Egyptian Fraction

Every positive fraction can be represented as sum of unique unit fractions. A fraction is unit fraction if numerator is 1 and denominator is a… Read More »

## Find length of period in decimal value of 1/n

Given a positive integer n, find the period in decimal value of 1/n. Period in decimal value is number of digits (somewhere after decimal point)… Read More »

## OLA Cabs Interview Experience | Set 2 (For Android – 1.5 Years)

First Round Written Test 1) Implement Stack Operations. Also maintain count of Largest Integer present in Stack at any given point of Time. 2) Implement… Read More »

## Can QuickSort be implemented in O(nLogn) worst case time complexity?

The worst case time complexity of a typical implementation of QuickSort is O(n2). The worst case occurs when the picked pivot is always an extreme… Read More »

## Fill two instances of all numbers from 1 to n in a specific way

Given a number n, create an array of size 2n such that the array contains 2 instances of every number from 1 to n, and… Read More »

## Weighted Job Scheduling

Given N jobs where every job is represented by following three elements of it. Start Time Finish Time Profit or Value Associated (>= 0) Find… Read More »

## Intuit Interview Experience | Set 7 (For 3.5 Years Experienced)

1st Round : (2 hrs) 1. Implement LRU Cache, 2. Implement your own Blocking Queue. 3. Questions on Collections , a. How AtomicInteger works b.… Read More »

## Komli Media Interview Experience

I recently attended Komli media interview and wanted to share the experience. First Round(Written) 1. Midas has boxes in three sizes: large, medium, and small.… Read More »