代码改变世界

随笔档案-2016年01月

206_Reverse Linked List

2016-01-14 16:19 by FTD_W, 123 阅读, 收藏,
摘要: Reverse a singly linked list./** * Definition for singly-linked list. * struct ListNode { * int val; * struct ListNode *next; * }; */struct Li... 阅读全文

13_Roman to Integer

2016-01-13 15:05 by FTD_W, 182 阅读, 收藏,
摘要: Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.罗马数字转化为阿拉伯数字I 1X 10C 100M 1000V 5L 50 ... 阅读全文

191_Number of 1 Bits

2016-01-13 14:38 by FTD_W, 136 阅读, 收藏,
摘要: Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as theHamming weight).For example, the 32-bit in... 阅读全文

318_Maximum Product of Word Lengths

2016-01-12 16:12 by FTD_W, 491 阅读, 收藏,
摘要: Given a string arraywords, find the maximum value oflength(word[i]) * length(word[j])where the two words do not share common letters. You may assume t... 阅读全文

235_Lowest Common Ancestor of a Binary Search Tree

2016-01-05 15:28 by FTD_W, 178 阅读, 收藏,
摘要: Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.According to thedefinition of LCA on Wikipedia: ... 阅读全文

319_Bulb Switcher

2016-01-04 13:24 by FTD_W, 393 阅读, 收藏,
摘要: There arenbulbs that are initially off. You first turn on all the bulbs. Then, you turn off every second bulb. On the third round, you toggle every th... 阅读全文

268_Missing Number

2016-01-03 10:29 by FTD_W, 272 阅读, 收藏,
摘要: Given an array containingndistinct numbers taken from0, 1, 2, ..., n, find the one that is missing from the array.For example,Givennums=[0, 1, 3]retur... 阅读全文