摘要:
题目: 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]. 阅读全文
随笔档案-2017年01月
Leetcode - 186 Reverse Words in a String II
2017-01-14 06:46 by Mux1, 153 阅读, 收藏,
摘要:
题目: Given an input string, reverse the string word by word. A word is defined as a sequence of non-space characters. The input string does not contain 阅读全文
Leetcode - 458 Poor Pigs
2017-01-12 00:40 by Mux1, 1679 阅读, 收藏,
摘要:
题目: 总共有1000个罐子,其中有且只有1个是毒药,另外其他的都是水. 现在用一群可怜的猪去找到那个毒药罐. 已知毒药让猪毒发的时间是15分钟, 那么在60分钟之内,最少需要几头猪来找出那个毒药罐? 分析: 为什么可怜不言而喻...本题可以这么考虑问题, 先是二维地排列罐子, 然后分别让两头猪去尝 阅读全文
LeetCode - 7 Reverse Integer
2017-01-11 22:33 by Mux1, 133 阅读, 收藏,
摘要:
题目: Reverse digits of an integer. Example1: x = 123, return 321Example2: x = -123, return -321 Have you thought about this? Here are some good questio 阅读全文
浙公网安备 33010602011771号