LeetCode整理
小柒木有熙
这个作者很懒,什么都没留下…
展开
-
不使用“+”“-”操作符计算两数之和
不使用“+”“-”操作符计算两数之和算法思路:设有a=3,b=6 a=0011, b =0110 所以不进位和是5 =0101,进位为2 =0010 所以a+b就变成了5+2<<1 然后有5 =0101, 2<<1 =0100 不进位和是1 =0001, 进位是4 =0100 所以a+b变成1+4<<1 然后有1 =0001, 4<<1 =1000 不进位和是9 =1001, 进位是0 =0000原创 2016-07-05 15:29:58 · 280 阅读 · 0 评论 -
LeetCode – Remove Nth Node From End of List (Java)
Given a linked list, remove the nth node from the end of list and return its head. For example, Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from the end, the原创 2016-09-19 14:32:01 · 202 阅读 · 0 评论