Given an array and a value, remove all instances of that value in place and return the new length.The order of elements can be changed. It doesn't mat...
分类:
其他好文 时间:
2015-07-20 10:42:29
阅读次数:
83
Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999. 1 class Solution { 2 public: 3 int roma...
分类:
其他好文 时间:
2015-07-20 10:41:04
阅读次数:
98
Write an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Starting with any positive integer...
分类:
移动开发 时间:
2015-07-20 10:37:56
阅读次数:
130
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 two nu...
分类:
其他好文 时间:
2015-07-20 10:37:39
阅读次数:
110
Given an integer, write a function to determine if it is a power of two. 1 bool isPowerOfTwo(int n) 2 { 3 if(n1)10 {11 if(n%2==0)12 ...
分类:
其他好文 时间:
2015-07-20 10:37:32
阅读次数:
124
Rotate an array ofnelements to the right byksteps.For example, withn= 7 andk= 3, the array[1,2,3,4,5,6,7]is rotated to[5,6,7,1,2,3,4].Note:Try to come...
分类:
其他好文 时间:
2015-07-20 10:36:03
阅读次数:
94
Given a linked list, swap every two adjacent nodes and return its head.For example,Given1->2->3->4, you should return the list as2->1->4->3.Your algor...
分类:
其他好文 时间:
2015-07-20 10:35:21
阅读次数:
101
Given a sorted linked list, delete all duplicates such that each element appear onlyonce.For example,Given1->1->2, return1->2.Given1->1->2->3->3, retu...
分类:
其他好文 时间:
2015-07-20 10:34:14
阅读次数:
106
Given an array of integers, every element appearsthreetimes except for one. Find that single one. 1 int singleNumber(int* nums, int numsSize) 2 { 3 .....
分类:
其他好文 时间:
2015-07-20 10:34:13
阅读次数:
121
Sort a linked list using insertion sort. 1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * struct ListNo...
分类:
其他好文 时间:
2015-07-20 10:33:09
阅读次数:
120