2015年12月18日

摘要: Happy NumberWrite an algorithm to determine if a number is happy.A happy number is a number defined by the following process: Starting with any positi... 阅读全文
posted @ 2015-12-18 01:52 一心一念 阅读(153) 评论(0) 推荐(0) 编辑

2015年12月11日

摘要: 3SumGiven an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum... 阅读全文
posted @ 2015-12-11 06:40 一心一念 阅读(183) 评论(0) 推荐(0) 编辑
摘要: 4SumGiven an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target?Find all unique quadruplets in the array w... 阅读全文
posted @ 2015-12-11 06:38 一心一念 阅读(129) 评论(0) 推荐(0) 编辑
摘要: Two SumGiven an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the... 阅读全文
posted @ 2015-12-11 06:00 一心一念 阅读(125) 评论(0) 推荐(0) 编辑
摘要: Divide Two IntegersDivide two integers without using multiplication, division and mod operator.If it is overflow, return 2147483647ExampleGiven divide... 阅读全文
posted @ 2015-12-11 04:20 一心一念 阅读(166) 评论(0) 推荐(0) 编辑

2015年12月10日

摘要: Count of Smaller NumberGive you an integer array (index from 0 to n-1, where n is the size of this array, value from 0 to 10000) and an query list. Fo... 阅读全文
posted @ 2015-12-10 06:11 一心一念 阅读(184) 评论(0) 推荐(0) 编辑
摘要: Intersection of Two Linked ListsWrite a program to find the node at which the intersection of two singly linked lists begins.ExampleThe following two ... 阅读全文
posted @ 2015-12-10 06:10 一心一念 阅读(106) 评论(0) 推荐(0) 编辑
摘要: Find the Missing NumberGiven an array contains N numbers of 0 .. N, find which number doesn't exist in the array.ExampleGiven N = 3 and the array [0, ... 阅读全文
posted @ 2015-12-10 06:07 一心一念 阅读(159) 评论(0) 推荐(0) 编辑

2015年12月9日

摘要: Palindrome Linked ListImplement a function to check if a linked list is a palindrome.ExampleGiven 1->2->1, return trueChallengeCould you do it in O(n)... 阅读全文
posted @ 2015-12-09 06:03 一心一念 阅读(134) 评论(0) 推荐(0) 编辑

2015年12月4日

摘要: Search a 2D MatrixWrite an efficient algorithm that searches for a value in an m x n matrix.This matrix has the following properties:Integers in each ... 阅读全文
posted @ 2015-12-04 05:35 一心一念 阅读(137) 评论(0) 推荐(0) 编辑

导航