随笔分类 -  Coding Made Simple

Lectures by Tushar Roy on Youtube.
摘要:Given an array of positive number, find maximum sum subsequence such that elements in this subsequence are not adjacent to each other. Recursive formu 阅读全文
posted @ 2017-08-22 13:13 Review->Improve 阅读(173) 评论(0) 推荐(0)
摘要:Find longest bitonic subsequence in given array. Bitonic subsequence first increases then decreases. Same problem link Longest Bitonic Subsequence 阅读全文
posted @ 2017-08-22 12:13 Review->Improve 阅读(160) 评论(0) 推荐(0)
摘要:Given a staircase and give you can take 1 or 2 steps at a time, how many ways you can reach nth step. Same problem link. Climbing Stairs 阅读全文
posted @ 2017-08-22 12:11 Review->Improve 阅读(115) 评论(0) 推荐(0)
摘要:Given a 2D immutable array, Write an efficient program to support any given sub-rectangle sum query in this 2D matrix. A simple solution is to add eac 阅读全文
posted @ 2017-08-22 12:08 Review->Improve 阅读(182) 评论(0) 推荐(0)
摘要:Given a 2D matrix where every element is either ‘O’ or ‘X’, find the largest subsquare surrounded by ‘X’. Examples: Solution 1. O(N^4) runtime. Consid 阅读全文
posted @ 2017-08-19 08:47 Review->Improve 阅读(386) 评论(0) 推荐(0)
摘要:Given a number n, find the total number of numbers from 0 to 2^n - 1 which do not have consecutive 1s in their binary representation. Solution. This p 阅读全文
posted @ 2017-08-19 04:15 Review->Improve 阅读(122) 评论(0) 推荐(0)
摘要:Given n which is total number of keys in BST, how many BSTs can be formed with n keys. Solution 1. Recursion Solution 2. Dynamic Programming 阅读全文
posted @ 2017-08-18 15:45 Review->Improve 阅读(127) 评论(0) 推荐(0)
摘要:Given a 2 dimensional matrix, how many ways you can reach bottom right from top left provided you can only move down and right. 阅读全文
posted @ 2017-08-18 15:26 Review->Improve 阅读(116) 评论(0) 推荐(0)
摘要:Count Number of Binary Tree Possible given Preorder Sequence. For example, given preorder sequence of {10, 11, 9, 12, 13, 14}, the total possible numb 阅读全文
posted @ 2017-08-18 14:50 Review->Improve 阅读(246) 评论(0) 推荐(0)
摘要:Given coins of certain denominations and a total, how many ways these coins can be combined to get the total. Dynamic Programming solution State: T[i] 阅读全文
posted @ 2017-08-18 13:30 Review->Improve 阅读(143) 评论(0) 推荐(0)
摘要:Given coins of certain denominations and a total, how many minimum coins would you need to make this total? Dynamic Programming solution State: T[i][j 阅读全文
posted @ 2017-08-18 13:08 Review->Improve 阅读(201) 评论(0) 推荐(0)
摘要:Given some number of floors and some number of eggs, what is the minimum number of attempts it will take to find out from which floor egg will break. 阅读全文
posted @ 2017-08-18 07:08 Review->Improve 阅读(204) 评论(0) 推荐(0)
摘要:Given certain jobs with start and end time and amount you make on finishing the job, find the maximum value you can make by scheduling jobs in non-ove 阅读全文
posted @ 2017-08-18 05:00 Review->Improve 阅读(1440) 评论(0) 推荐(0)
摘要:Given a rod of length and prices at which different length of this rod can sell, how do you cut this rod to maximize profit. Solution. Dynamic Program 阅读全文
posted @ 2017-08-18 02:10 Review->Improve 阅读(229) 评论(0) 推荐(0)
摘要:Given two strings, find longest common substring between them. Solution 1. Brute force search, O(n^2 * m), O(1) memory Algorithm. O(n^2) runtime to fi 阅读全文
posted @ 2017-08-18 01:00 Review->Improve 阅读(293) 评论(0) 推荐(0)
摘要:Given keys and frequency at which these keys are searched, how would you create a binary search tree from these keys such that the cost of searching i 阅读全文
posted @ 2017-08-16 14:14 Review->Improve 阅读(623) 评论(0) 推荐(0)
摘要:Given a set of distinct integers, return all possible subsets. Notice Elements in a subset must be in non-descending order. The solution set must not 阅读全文
posted @ 2017-08-08 13:26 Review->Improve 阅读(250) 评论(0) 推荐(0)
摘要:Given a set of non negative integers and a target value, find if there exists a subset in the given set whose sum is target. Solution 1. Enumerate all 阅读全文
posted @ 2017-08-08 12:50 Review->Improve 阅读(527) 评论(0) 推荐(0)
摘要:Given some matrices, in what order you would multiply them to minimize cost of multiplication. The following problem formulation is extracted from thi 阅读全文
posted @ 2017-08-04 12:31 Review->Improve 阅读(506) 评论(0) 推荐(0)
摘要:Given two strings, find the longest common subsequence (LCS). Your code should return the length of LCS. Given two strings, find the longest common su 阅读全文
posted @ 2017-08-02 14:02 Review->Improve 阅读(191) 评论(0) 推荐(0)