Remove Duplicates from Sorted ArrayGiven a sorted array, remove the duplicates in place such that each element appear onlyonceand return the new lengt...
分类:
其他好文 时间:
2014-07-22 22:48:14
阅读次数:
224
Remove Duplicates from Sorted Array IIFollow up for "Remove Duplicates":What if duplicates are allowed at mosttwice?For example,Given sorted array A =...
分类:
其他好文 时间:
2014-07-22 22:48:13
阅读次数:
201
题目:Follow up for "Search in Rotated Sorted Array":What if duplicates are allowed?Would this affect the run-time complexity? How and why?Write a funct....
分类:
编程语言 时间:
2014-07-22 22:47:55
阅读次数:
214
题目:Given 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 tw....
分类:
编程语言 时间:
2014-07-22 22:47:33
阅读次数:
256
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.题解:开始想到的方法比较偷懒,直接遍历一遍数组,把每个ListNode对应的值放到...
分类:
其他好文 时间:
2014-07-22 22:45:13
阅读次数:
271
B. Suffix Structure 1. 先判断s去掉一些元素是否能构成t,如果可以就是automaton 判断的方法也很简单,two pointer,相同元素同时++,不相同s的指针++,如果t能全找到,那么s能够去掉元素构成t。 bool f(string s, string t) { in...
分类:
其他好文 时间:
2014-07-22 22:44:54
阅读次数:
139
Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the ord...
分类:
其他好文 时间:
2014-07-22 00:13:35
阅读次数:
154
1.Given an array where elements are sorted in ascending order, convert it to a height balanced BST.
2.Given a singly linked list where elements are sorted in ascending order, convert it to a heig...
分类:
其他好文 时间:
2014-07-21 23:45:53
阅读次数:
264
Sumdiv
Description
Consider two natural numbers A and B. Let S be the sum of all natural divisors of A^B. Determine S modulo 9901 (the rest of the division of S by 9901).
Input
The only line...
分类:
其他好文 时间:
2014-07-21 16:27:12
阅读次数:
187
Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical an...
分类:
其他好文 时间:
2014-07-21 14:35:26
阅读次数:
206