摘要:
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... 阅读全文
摘要:
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 --... 阅读全文
摘要:
一、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... 阅读全文
摘要:
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?分析:题意为判断单链表是否为回文的。思路:首先想到的是 遍历一次单链表,... 阅读全文
摘要:
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: ... 阅读全文
摘要:
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 -> ... 阅读全文
摘要:
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... 阅读全文
摘要:
在C&C++中一、inline关键字用来定义一个类的内联函数,引入它的主要原因是用它替代C中表达式形式的宏定义。表达式形式的宏定义一例:#define ExpressionName(Var1,Var2) ((Var1)+(Var2))*((Var1)-(Var2))取代这种形式的原因如下:1. C中... 阅读全文
摘要:
参见MySQL(以5.1为例)中官方手册:MySQL官方手册-JOIN假设有以下几个表t1idbook1java2c++3phpt2idauthor2zhang3wang4lit3authoryearzhang2003ma2006liu2011Inner Join 内连接将两个表中存在连接关系的字段... 阅读全文
摘要:
Isomorphic StringsGiven two stringssandt, determine if they are isomorphic.Two strings are isomorphic if the characters inscan be replaced to gett.All... 阅读全文