摘要: 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... 阅读全文
posted @ 2015-07-19 10:29 小金乌会发光-Z&M 阅读(146) 评论(0) 推荐(0) 编辑
摘要: Remove all elements from a linked list of integers that have valueval.ExampleGiven:1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6,val= 6Return:1 --> 2 --> 3 --... 阅读全文
posted @ 2015-07-18 22:04 小金乌会发光-Z&M 阅读(174) 评论(0) 推荐(0) 编辑
摘要: 一、Rank ScoresWrite a SQL query to rank scores. If there is a tie between two scores, both should have the same ranking. Note that after a tie, the nex... 阅读全文
posted @ 2015-07-17 19:58 小金乌会发光-Z&M 阅读(185) 评论(0) 推荐(0) 编辑
摘要: Given a singly linked list, determine if it is a palindrome.Follow up:Could you do it in O(n) time and O(1) space?分析:题意为判断单链表是否为回文的。思路:首先想到的是 遍历一次单链表,... 阅读全文
posted @ 2015-07-17 17:13 小金乌会发光-Z&M 阅读(179) 评论(0) 推荐(0) 编辑
摘要: 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: ... 阅读全文
posted @ 2015-07-17 10:55 小金乌会发光-Z&M 阅读(189) 评论(0) 推荐(0) 编辑
摘要: Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.Supposed the linked list is1 -> 2 -> 3 -> ... 阅读全文
posted @ 2015-07-16 22:28 小金乌会发光-Z&M 阅读(204) 评论(0) 推荐(0) 编辑
摘要: You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping yo... 阅读全文
posted @ 2015-07-16 13:36 小金乌会发光-Z&M 阅读(288) 评论(0) 推荐(0) 编辑
摘要: 在C&C++中一、inline关键字用来定义一个类的内联函数,引入它的主要原因是用它替代C中表达式形式的宏定义。表达式形式的宏定义一例:#define ExpressionName(Var1,Var2) ((Var1)+(Var2))*((Var1)-(Var2))取代这种形式的原因如下:1. C中... 阅读全文
posted @ 2015-07-15 20:45 小金乌会发光-Z&M 阅读(684) 评论(1) 推荐(1) 编辑
摘要: 参见MySQL(以5.1为例)中官方手册:MySQL官方手册-JOIN假设有以下几个表t1idbook1java2c++3phpt2idauthor2zhang3wang4lit3authoryearzhang2003ma2006liu2011Inner Join 内连接将两个表中存在连接关系的字段... 阅读全文
posted @ 2015-07-15 15:10 小金乌会发光-Z&M 阅读(260) 评论(0) 推荐(0) 编辑
摘要: Isomorphic StringsGiven two stringssandt, determine if they are isomorphic.Two strings are isomorphic if the characters inscan be replaced to gett.All... 阅读全文
posted @ 2015-07-11 23:45 小金乌会发光-Z&M 阅读(183) 评论(0) 推荐(0) 编辑