上一页 1 ··· 5 6 7 8 9 10 11 下一页
摘要: Rotate an array of n elements to the right by k steps. For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4]. Not 阅读全文
posted @ 2017-01-22 11:20 璨璨要好好学习 阅读(101) 评论(0) 推荐(0) 编辑
摘要: Given an integer n, return the number of trailing zeroes in n!. Note: Your solution should be in logarithmic time complexity. 这道题首先要读懂题目。。。一开始连factori 阅读全文
posted @ 2017-01-22 05:09 璨璨要好好学习 阅读(119) 评论(0) 推荐(0) 编辑
摘要: Write a function to find the longest common prefix string amongst an array of strings. 这道题利用stringbuffer的delete方法 topsolution是用substring的 还可以用Arrays.s 阅读全文
posted @ 2017-01-21 03:06 璨璨要好好学习 阅读(108) 评论(0) 推荐(0) 编辑
摘要: Reverse digits of an integer. Example1: x = 123, return 321Example2: x = -123, return -321 这道题要考虑反转之后overflow的问题,感觉我的写法很非主流啊。 还是用主流写法又写了一下 阅读全文
posted @ 2017-01-20 08:58 璨璨要好好学习 阅读(99) 评论(0) 推荐(0) 编辑
摘要: Given a linked list, determine if it has a cycle in it. Follow up:Can you solve it without using extra space? 这道题很简单也很经典感觉。一开始用hashset做的,但这样就用了extra s 阅读全文
posted @ 2017-01-19 11:13 璨璨要好好学习 阅读(111) 评论(0) 推荐(0) 编辑
摘要: Given an array and a value, remove all instances of that value in place and return the new length. Do not allocate extra space for another array, you 阅读全文
posted @ 2017-01-19 10:48 璨璨要好好学习 阅读(136) 评论(0) 推荐(0) 编辑
摘要: Write a function that takes a string as input and reverse only the vowels of a string. Example 1:Given s = "hello", return "holle". Example 2:Given s 阅读全文
posted @ 2017-01-19 08:18 璨璨要好好学习 阅读(136) 评论(0) 推荐(0) 编辑
摘要: Count the number of segments in a string, where a segment is defined to be a contiguous sequence of non-space characters. Please note that the string 阅读全文
posted @ 2017-01-19 06:04 璨璨要好好学习 阅读(156) 评论(0) 推荐(0) 编辑
摘要: Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction 阅读全文
posted @ 2017-01-19 00:07 璨璨要好好学习 阅读(126) 评论(0) 推荐(0) 编辑
摘要: 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 intege 阅读全文
posted @ 2017-01-18 12:08 璨璨要好好学习 阅读(168) 评论(0) 推荐(0) 编辑
上一页 1 ··· 5 6 7 8 9 10 11 下一页