code jam Tidy Numbers — concise implementation guide and walkthrough on CollegeStash. Read more →
Category: interview
-
Find the maximum size of square of side ‘X’ in a matrix
We use dynamic programming to solve this. Space complexity = O(2*n) Time complexity = O(n^3). Output Read more →
-
Knapsack Bounded(1/0), Unbounded, Bounded/Fraction, Unbounded/Fraction Solutions
Bounded Knapsack (1/0) Solution in Java using Dynamic Programming There are few items with weights and values, we need to find the items that contribute the maximum value that can be stored in knapsack of a particular capacity.… Read more →
-
Use DFS to flatten Javascript Objects
This is straight forward implementation of the DFS (Depth First Search) traversal algorithm using recursion. String Accumulation Using an Array Stack + Backtracking ES6 Output Demo Read more →
-
Get maximum sum rectangle sub matrix in a 2D matrix
This problem can be solved using Kadane's Algorithm. We start by taking an empty array of zeros of size of the number of rows of input matrix. We move from left to right columns and calculate max for… Read more →
-
Kadane’s Algorithm for maximum sum subarray with Indices [Handles Negatives] O(n)
This algorithm can be used to calculate the maximum sum subarray with indices in any given array (length n) of integers in O(n) Time and O(1) space. Python Java This algorithm can be used to find out the… Read more →
-
Sorting Objects in a Priority Queue
This is an implementation that shows you how to override the comparator to sort objects by a property in a Priority Queue. You can use Priority Queues in algorithms like Dijkstra's and A* to remove the element with… Read more →
-
Generate All Subsets for a Set using Javascript
The total number of subsets for any given set of size 'n' is 2^n (nC0 + nC1 + nC2 + ….. + nCn). In the following program we use all the possible binary values between 0 (inclusive) and… Read more →
-
Convert Integer to Binary using Javascript
Convert Integer to Binary using Javascript — clean JavaScript solution and code implementation for software engineering interview preparation. Read more →