自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

ActiveCoder的博客

Algorithms seen

  • 博客(16)
  • 收藏
  • 关注

原创 Balanced Partition of Array

Given an array which contains random positive integers, divide the array into two parts which has the smallest diff sum, return the smallest diff sum.This problem is solvable using dynamic programmi

2016-07-27 12:32:47 488

原创 LeetCode 375. Guess Number Higher or Lower II

We are playing the Guess Game. The game is as follows:I pick a number from 1 to n. You have to guess which number I picked.Every time you guess wrong, I'll tell you whether the number I pi

2016-07-26 03:51:16 524

原创 374. Guess Number Higher or Lower

We are playing the Guess Game. The game is as follows:I pick a number from 1 to n. You have to guess which number I picked.Every time you guess wrong, I'll tell you whether the number is h

2016-07-25 23:47:02 212

原创 LeetCode 366. Find Leaves of Binary Tree

Given a binary tree, find all leaves and then remove those leaves. Then repeat the previous steps until the tree is empty.Example:Given binary tree  1 / \ 2 3

2016-07-25 23:29:15 270

原创 Maximum array distance Sum

Question: Given an array, find the maximum array distance sum. Array distance sum is defined as below. For any 0 For example, Given array {0, 2, -1}A[0][0] = 0, A[0][1] = 3, A[0][2] = 1; A[1][1] =

2016-07-25 12:46:31 211

原创 Dynamic Programming series

DP is absolutely the best way to category levels of programming..... and it is always the favourite questions being asked by FB or Google.1: Entry Level DP problem.    /* A sequence of numbers i

2016-07-21 07:08:54 270

原创 TODO: house robber IIII

TODO: when rob one, the neighbour explored, get the max rob value.

2016-07-20 11:27:42 211

原创 TODO: System design a recommendation system

TODO: design a recommendation system.

2016-07-18 10:40:43 281

原创 Shuffle related problem.

Shuffle is quite a frequently asked question in interviews. The most famous one is shuffle a deck of cards.Peiyush Jain, 2004 published a paper "A simple in-place Algorithm for in-Shuffle". However

2016-07-18 09:59:05 570

转载 Haffman Encoding and Decoding

Read this blog and it seems this is a quite decent interview question. Haffman encodingHaffman encoding is  a classic way to encode characters. It encodes characters according to building an optimis

2016-07-18 06:27:49 257

原创 Find Closet Pairs -- To be continue

1: Find closet pair number in an given array2: Find closet pair of points in an array of given points.3: Given a set of triangles, find the most overlapped points.  (TODO: Will update them on July

2016-07-09 12:00:42 308

原创 Subarray Sum to the given target value

Question: check if there is a subarray sum equals to the given target.This question should ask for clarifications. Whether the inputs are all positive, or it has negative numbers.1: If all the num

2016-07-07 06:13:00 506

原创 Primes Product

Maybe think about how to solve it iteratively??#include "header.h"using namespace std;void primeProduct(vector& nums, vector& res, int product, int pos) { if(pos > nums.size()) { return;

2016-07-07 02:15:08 264

原创 Random Number Series Questions

This webpage gives a perfect solution to generate K random numbers from given N size array: http://www.geeksforgeeks.org/reservoir-sampling/However, there are a varieties of related questions.1: i

2016-07-06 07:59:24 211

原创 Next Larger Value in BST

This question need some clarification of the TreeNode structure. Suppose the given TreeNode struct is as following:Struct TreeNode {int val;TreeNode* left;TreeNode* right;TreeNode(int v) :

2016-07-06 04:41:31 252

原创 K consecutive maxSum

// given an array, find n consecutive number which forms the largest sum.#include "header.h"using namespace std;int maxConsecutive(vector& array, int n) { if(n <= 0) return 0; vector dp(array.

2016-07-05 11:58:04 239

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除