Fork me on GitHub
上一页 1 2 3 4 5 6 7 8 9 ··· 22 下一页
摘要: 题目:GivennumRows, generate the firstnumRowsof Pascal's triangle.For example, givennumRows= 5,Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4... 阅读全文
posted @ 2015-09-02 09:31 __Neo 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 题目:Given an integer, write a function to determine if it is a power of two.提示:此题判断输入的数是否是2的次方。如果一个数是2的次方,那么它的二进制数只有一个1,其他都是0。根据这一定理,我们可以用如下方法解决这一问题:第一... 阅读全文
posted @ 2015-09-01 16:03 __Neo 阅读(137) 评论(0) 推荐(0) 编辑
摘要: 题目:Implement the following operations of a stack using queues.push(x) -- Push element x onto stack.pop() -- Removes the element on top of the stack.to... 阅读全文
posted @ 2015-09-01 14:53 __Neo 阅读(331) 评论(0) 推荐(0) 编辑
摘要: 题目:Implement the following operations of a queue using stacks.push(x) -- Push element x to the back of queue.pop() -- Removes the element from in fron... 阅读全文
posted @ 2015-09-01 14:30 __Neo 阅读(115) 评论(0) 推荐(0) 编辑
摘要: 题目:Given two sorted integer arraysnums1andnums2, mergenums2intonums1as one sorted array.Note:You may assume thatnums1has enough space (size that is gr... 阅读全文
posted @ 2015-08-31 15:57 __Neo 阅读(168) 评论(0) 推荐(0) 编辑
摘要: 题目: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, r... 阅读全文
posted @ 2015-08-31 15:30 __Neo 阅读(109) 评论(0) 推荐(0) 编辑
摘要: 题目:You are climbing a stair case. It takesnsteps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you cl... 阅读全文
posted @ 2015-08-31 10:04 __Neo 阅读(475) 评论(0) 推荐(0) 编辑
摘要: 题目:Given two binary strings, return their sum (also a binary string).For example,a ="11"b ="1"Return"100".提示:此题我的第一反应是把输入的两个字符串转化为数字,相加以后再把结果转化为二进制输出,... 阅读全文
posted @ 2015-08-29 16:45 __Neo 阅读(135) 评论(0) 推荐(0) 编辑
摘要: 题目:Given a stringsconsists of upper/lower-case alphabets and empty space characters' ', return the length of last word in the string.If the last word ... 阅读全文
posted @ 2015-08-28 15:36 __Neo 阅读(101) 评论(0) 推荐(0) 编辑
摘要: 题目:Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.提示:此题可以使用暴力搜索方法。当然也可以使用... 阅读全文
posted @ 2015-08-28 10:32 __Neo 阅读(193) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 ··· 22 下一页