2015年11月5日
摘要: 题目:Given an array of sizen, find the majority element. The majority element is the element that appears more than⌊ n/2 ⌋times.You may assume that the ... 阅读全文
posted @ 2015-11-05 21:32 已停更 阅读(183) 评论(0) 推荐(0)
摘要: 题目:Given two stringssandt, write a function to determine iftis an anagram ofs.For example,s= "anagram",t= "nagaram", return true.s= "rat",t= "car", re... 阅读全文
posted @ 2015-11-05 15:16 已停更 阅读(183) 评论(0) 推荐(0)
摘要: 题目: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... 阅读全文
posted @ 2015-11-05 14:23 已停更 阅读(229) 评论(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 Wikipedi... 阅读全文
posted @ 2015-11-05 09:04 已停更 阅读(186) 评论(0) 推荐(0)