摘要: House RobberⅠ You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constrai 阅读全文
posted @ 2018-07-15 17:02 Lin.B 阅读(121) 评论(0) 推荐(0) 编辑
摘要: Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation and r 阅读全文
posted @ 2018-07-15 15:19 Lin.B 阅读(91) 评论(0) 推荐(0) 编辑
摘要: 今天处理一下一系列题目:Next Greater Element系列。 Next Greater Element I You are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are su 阅读全文
posted @ 2018-07-13 23:16 Lin.B 阅读(134) 评论(0) 推荐(0) 编辑
摘要: Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST. According to the definition of LCA on Wikipedia 阅读全文
posted @ 2018-07-13 19:53 Lin.B 阅读(89) 评论(0) 推荐(0) 编辑
摘要: Given an integer array with even length, where different numbers in this array represent different kinds of candies. Each number means one candy of th 阅读全文
posted @ 2018-07-13 12:07 Lin.B 阅读(109) 评论(0) 推荐(0) 编辑
摘要: Give a string s, count the number of non-empty (contiguous) substrings that have the same number of 0's and 1's, and all the 0's and all the 1's in th 阅读全文
posted @ 2018-07-13 11:44 Lin.B 阅读(94) 评论(0) 推荐(0) 编辑
摘要: Given a sorted (in ascending order) integer array nums of n elements and a target value, write a function to search target in nums. If target exists, 阅读全文
posted @ 2018-07-13 10:41 Lin.B 阅读(101) 评论(0) 推荐(0) 编辑
摘要: There is a brick wall in front of you. The wall is rectangular and has several rows of bricks. The bricks have the same height but different width. Yo 阅读全文
posted @ 2018-07-12 11:58 Lin.B 阅读(148) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, return the inorder traversal of its nodes' values. Example: Input: [1,null,2,3] 1 \ 2 / 3 Output: [1,3,2] Follow up: Recursive so 阅读全文
posted @ 2018-07-11 17:50 Lin.B 阅读(74) 评论(0) 推荐(0) 编辑
摘要: Given a positive integer, check whether it has alternating bits: namely, if two adjacent bits will always have different values. Example 1: Input: 5 O 阅读全文
posted @ 2018-07-11 17:39 Lin.B 阅读(99) 评论(0) 推荐(0) 编辑