07 2017 档案
103. Binary Tree Zigzag Level Order Traversal
摘要:Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and 阅读全文
posted @ 2017-07-31 15:04 Beserious 阅读(126) 评论(0) 推荐(0) 编辑
leetcode 226. Invert Binary Tree
摘要:Invert a binary tree. to . 阅读全文
posted @ 2017-07-30 20:26 Beserious 阅读(126) 评论(0) 推荐(0) 编辑
leetcode 520. Detect Capital
摘要:Given a word, you need to judge whether the usage of capitals in it is right or not. We define the usage of capitals in a word to be right when one of 阅读全文
posted @ 2017-07-30 19:59 Beserious 阅读(139) 评论(0) 推荐(0) 编辑
#1542 : 无根数变有根树
摘要:时间限制:10000ms 单点时限:1000ms 内存限制:256MB 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 给定一棵包含 N 个节点的无根树,小Hi想知道如果指定其中某个节点 K 为根,那么每个节点的父节点是谁? 输入 第一行包含一个整数 N 和 K。1 ≤ 阅读全文
posted @ 2017-07-30 17:25 Beserious 阅读(222) 评论(0) 推荐(0) 编辑
#1543 : SCI表示法
摘要:时间限制:10000ms 单点时限:1000ms 内存限制:256MB 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 每一个正整数 N 都能表示成若干个连续正整数的和,例如10可以表示成1+2+3+4,15可以表示成4+5+6,8可以表示成8本身。我们称这种表示方法为 阅读全文
posted @ 2017-07-30 17:24 Beserious 阅读(503) 评论(0) 推荐(0) 编辑
leetcode 414. Third Maximum Number
摘要:Given a non-empty array of integers, return the third maximum number in this array. If it does not exist, return the maximum number. The time complexi 阅读全文
posted @ 2017-07-29 19:00 Beserious 阅读(138) 评论(0) 推荐(0) 编辑
leetcode 532. K-diff Pairs in an Array
摘要:Given an array of integers and an integer k, you need to find the number of unique k-diff pairs in the array. Here a k-diff pair is defined as an inte 阅读全文
posted @ 2017-07-29 15:30 Beserious 阅读(173) 评论(0) 推荐(0) 编辑
leetcode 581. Shortest Unsorted Continuous Subarray
摘要:Given an integer array, you need to find one continuous subarray that if you only sort this subarray in ascending order, then the whole array will be 阅读全文
posted @ 2017-07-29 12:41 Beserious 阅读(136) 评论(0) 推荐(0) 编辑
leetcode 605. Can Place Flowers
摘要:Suppose you have a long flowerbed in which some of the plots are planted and some are not. However, flowers cannot be planted in adjacent plots - they 阅读全文
posted @ 2017-07-29 10:17 Beserious 阅读(374) 评论(0) 推荐(0) 编辑
leetcode 219. Contains Duplicate II
摘要:Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and the  阅读全文
posted @ 2017-07-29 09:35 Beserious 阅读(149) 评论(0) 推荐(0) 编辑
leetcode 283. Move Zeroes
摘要:Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements. For example, giv 阅读全文
posted @ 2017-07-28 17:21 Beserious 阅读(151) 评论(0) 推荐(0) 编辑
leetcode 217. Contains Duplicate
摘要:Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the arr 阅读全文
posted @ 2017-07-28 16:34 Beserious 阅读(196) 评论(0) 推荐(0) 编辑
leetcode 628. Maximum Product of Three Numbers
摘要:Given an integer array, find three numbers whose product is maximum and output the maximum product. Example 1: Example 2: Note: 排序,然后前后枚举一下就行了 3种情况。 或 阅读全文
posted @ 2017-07-28 16:22 Beserious 阅读(143) 评论(0) 推荐(0) 编辑
leetcode 268. Missing Number
摘要:Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. For example,Given nums = [0, 1, 阅读全文
posted @ 2017-07-28 16:03 Beserious 阅读(140) 评论(0) 推荐(0) 编辑
448. Find All Numbers Disappeared in an Array
摘要:Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements of [1, n] 阅读全文
posted @ 2017-07-28 15:58 Beserious 阅读(146) 评论(0) 推荐(0) 编辑
leetcode 485. Max Consecutive Ones
摘要:Given a binary array, find the maximum number of consecutive 1s in this array. Example 1: Note: The input array will only contain 0 and 1. The length 阅读全文
posted @ 2017-07-28 12:09 Beserious 阅读(144) 评论(0) 推荐(0) 编辑
496. Next Greater Element I
摘要:You are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of nums2. Find all the next greater numbers for nums1' 阅读全文
posted @ 2017-07-28 11:39 Beserious 阅读(132) 评论(0) 推荐(0) 编辑
leetcode 463. Island Perimeter
摘要:You are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water. Grid cells are connected horizontally/ve 阅读全文
posted @ 2017-07-28 10:19 Beserious 阅读(133) 评论(0) 推荐(0) 编辑
leetcode 637. Average of Levels in Binary Tree
摘要:Given a non-empty binary tree, return the average value of the nodes on each level in the form of an array. Example 1: Note: 阅读全文
posted @ 2017-07-28 10:03 Beserious 阅读(165) 评论(0) 推荐(0) 编辑
412. Fizz Buzz
摘要:Write a program that outputs the string representation of numbers from 1 to n. But for multiples of three it should output “Fizz” instead of the numbe 阅读全文
posted @ 2017-07-28 09:55 Beserious 阅读(177) 评论(0) 推荐(0) 编辑
leetcode 566. Reshape the Matrix
摘要:In MATLAB, there is a very useful function called 'reshape', which can reshape a matrix into a new one with different size but keep its original data. 阅读全文
posted @ 2017-07-28 09:42 Beserious 阅读(155) 评论(0) 推荐(0) 编辑
leetcode 575. Distribute Candies
摘要: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 @ 2017-07-28 09:32 Beserious 阅读(219) 评论(0) 推荐(0) 编辑
344. Reverse String
摘要:Write a function that takes a string as input and returns the string reversed. Example:Given s = "hello", return "olleh". 反转字符串,逼我不用 reverse 阅读全文
posted @ 2017-07-27 22:02 Beserious 阅读(84) 评论(0) 推荐(0) 编辑
557. Reverse Words in a String III
摘要:Given a string, you need to reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order. E 阅读全文
posted @ 2017-07-27 21:40 Beserious 阅读(160) 评论(0) 推荐(0) 编辑
500. Keyboard Row
摘要:Given a List of words, return the words that can be typed using letters of alphabet on only one row's of American keyboard like the image below. Examp 阅读全文
posted @ 2017-07-27 21:21 Beserious 阅读(157) 评论(0) 推荐(0) 编辑
476. Number Complement
摘要:Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation. Note: Example 1: Exa 阅读全文
posted @ 2017-07-27 20:15 Beserious 阅读(134) 评论(0) 推荐(0) 编辑
561. Array Partition I
摘要:Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), ..., (an, bn) which makes sum of 阅读全文
posted @ 2017-07-27 19:45 Beserious 阅读(116) 评论(0) 推荐(0) 编辑
617. Merge Two Binary Trees
摘要:Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are n 阅读全文
posted @ 2017-07-27 17:04 Beserious 阅读(145) 评论(0) 推荐(0) 编辑
461. Hamming Distance
摘要:The Hamming distance between two integers is the number of positions at which the corresponding bits are different. Given two integers x and y, calcul 阅读全文
posted @ 2017-07-27 12:45 Beserious 阅读(186) 评论(0) 推荐(0) 编辑
160. Intersection of Two Linked Lists
摘要:Write a program to find the node at which the intersection of two singly linked lists begins. For example, the following two linked lists: begin to in 阅读全文
posted @ 2017-07-26 13:28 Beserious 阅读(134) 评论(0) 推荐(0) 编辑
169. Majority Element
摘要:Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that the 阅读全文
posted @ 2017-07-26 12:14 Beserious 阅读(128) 评论(0) 推荐(0) 编辑
171. Excel Sheet Column Number
摘要:Related to question Excel Sheet Column Title Given a column title as appear in an Excel sheet, return its corresponding column number. For example: 从2 阅读全文
posted @ 2017-07-26 08:07 Beserious 阅读(181) 评论(0) 推荐(0) 编辑
168. Excel Sheet Column Title
摘要:Given a positive integer, return its corresponding column title as appear in an Excel sheet. For example: 其实类似26进制数 阅读全文
posted @ 2017-07-26 07:58 Beserious 阅读(133) 评论(0) 推荐(0) 编辑
189. Rotate Array
摘要:Rotate an array of n elements to the right by k steps. For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4]. Not 阅读全文
posted @ 2017-07-25 18:35 Beserious 阅读(103) 评论(0) 推荐(0) 编辑
172. Factorial Trailing Zeroes
摘要:Given an integer n, return the number of trailing zeroes in n!. Note: Your solution should be in logarithmic time complexity. 求n得阶层,末尾0的个数 老问题了,统计2,5的 阅读全文
posted @ 2017-07-25 15:21 Beserious 阅读(71) 评论(0) 推荐(0) 编辑
176. Second Highest Salary
摘要:Write a SQL query to get the second highest salary from the Employee table. For example, given the above Employee table, the query should return 200 a 阅读全文
posted @ 2017-07-25 12:28 Beserious 阅读(115) 评论(0) 推荐(0) 编辑
167. Two Sum II - Input array is sorted (二分ortwo-pointer)
摘要:Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number. The function 阅读全文
posted @ 2017-07-25 11:54 Beserious 阅读(117) 评论(0) 推荐(0) 编辑
155. Min Stack
摘要:Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. push(x) -- Push element x onto stack. pop() -- Remov 阅读全文
posted @ 2017-07-25 11:12 Beserious 阅读(141) 评论(0) 推荐(0) 编辑
141. Linked List Cycle
摘要:Given a linked list, determine if it has a cycle in it. Follow up:Can you solve it without using extra space? 一个+1 一个+2 看看能不能相遇。注意代码不要写乱了...以后尽量用p1 p2 阅读全文
posted @ 2017-07-24 20:38 Beserious 阅读(116) 评论(0) 推荐(0) 编辑
136. Single Number
摘要:Given an array of integers, every element appears twice except for one. Find that single one. Note:Your algorithm should have a linear runtime complex 阅读全文
posted @ 2017-07-24 17:36 Beserious 阅读(118) 评论(0) 推荐(0) 编辑
125. Valid Palindrome
摘要:Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. For example,"A man, a plan, a canal: Pan 阅读全文
posted @ 2017-07-24 17:30 Beserious 阅读(144) 评论(0) 推荐(0) 编辑
122. Best Time to Buy and Sell Stock II
摘要:Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may comple 阅读全文
posted @ 2017-07-24 16:09 Beserious 阅读(129) 评论(0) 推荐(0) 编辑
121. Best Time to Buy and Sell Stock
摘要:Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction 阅读全文
posted @ 2017-07-24 14:54 Beserious 阅读(132) 评论(0) 推荐(0) 编辑
119. Pascal's Triangle II
摘要:Given an index k, return the kth row of the Pascal's triangle. For example, given k = 3,Return [1,3,3,1]. Note:Could you optimize your algorithm to us 阅读全文
posted @ 2017-07-24 12:48 Beserious 阅读(166) 评论(0) 推荐(0) 编辑
118. Pascal's Triangle
摘要:Given numRows, generate the first numRows of Pascal's triangle. For example, given numRows = 5,Return 注意左右的边界赋值 阅读全文
posted @ 2017-07-24 12:19 Beserious 阅读(124) 评论(0) 推荐(0) 编辑
112. Path Sum
摘要:Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum. F 阅读全文
posted @ 2017-07-24 11:54 Beserious 阅读(110) 评论(0) 推荐(0) 编辑
111. Minimum Depth of Binary Tree
摘要:Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest l 阅读全文
posted @ 2017-07-24 11:30 Beserious 阅读(110) 评论(0) 推荐(0) 编辑
110. Balanced Binary Tree
摘要:Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary tree is defined as a binary tree in which the dept 阅读全文
posted @ 2017-07-24 10:48 Beserious 阅读(123) 评论(0) 推荐(0) 编辑
108. Convert Sorted Array to Binary Search Tree
摘要:Given an array where elements are sorted in ascending order, convert it to a height balanced BST. 给定有序数组构造二叉搜索树。考虑到二叉搜索树的性质(中序遍历二叉搜索树可以得到一个排序好的数组) 构造的 阅读全文
posted @ 2017-07-23 17:30 Beserious 阅读(108) 评论(0) 推荐(0) 编辑
107.Binary Tree Level Order Traversal II
摘要:Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root). For 阅读全文
posted @ 2017-07-22 17:29 Beserious 阅读(125) 评论(0) 推荐(0) 编辑
104. Maximum Depth of Binary Tree
摘要:Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest l 阅读全文
posted @ 2017-07-21 18:13 Beserious 阅读(108) 评论(0) 推荐(0) 编辑
101. Symmetric Tree
摘要:Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree [1,2,2,3,4,4,3] is symmet 阅读全文
posted @ 2017-07-21 17:54 Beserious 阅读(114) 评论(0) 推荐(0) 编辑
100. Same Tree
摘要:Given two binary trees, write a function to check if they are equal or not. Two binary trees are considered equal if they are structurally identical a 阅读全文
posted @ 2017-07-21 15:53 Beserious 阅读(121) 评论(0) 推荐(0) 编辑
88. Merge Sorted Array
摘要:Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. Note:You may assume that nums1 has enough space (size tha 阅读全文
posted @ 2017-07-21 15:29 Beserious 阅读(98) 评论(0) 推荐(0) 编辑
83. Remove Duplicates from Sorted List
摘要:Given a sorted linked list, delete all duplicates such that each element appear only once. For example,Given 1->1->2, return 1->2.Given 1->1->2->3->3, 阅读全文
posted @ 2017-07-20 19:08 Beserious 阅读(110) 评论(0) 推荐(0) 编辑
70. Climbing Stairs
摘要:You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you cl 阅读全文
posted @ 2017-07-20 18:05 Beserious 阅读(136) 评论(0) 推荐(0) 编辑
69. Sqrt(x)
摘要:Implement int sqrt(int x). Compute and return the square root of x. 二分可解 这里是关于二分的一些总结: 首先,如果题目属于"二分值越大越符合条件",即要求符合条件的最小值,那就是while(r>l){mid=(l+r)/2。。。} 阅读全文
posted @ 2017-07-20 16:32 Beserious 阅读(120) 评论(0) 推荐(0) 编辑
67. Add Binary
摘要:Given two binary strings, return their sum (also a binary string). For example,a = "11"b = "1"Return "100". 模拟二进制相加,右对齐,然后每位相加....不知道字符串左加和右加对性能有没有影响 阅读全文
posted @ 2017-07-20 13:45 Beserious 阅读(114) 评论(0) 推荐(0) 编辑
66. Plus One
摘要:Given a non-negative integer represented as a non-empty array of digits, plus one to the integer. You may assume the integer do not contain any leadin 阅读全文
posted @ 2017-07-20 11:51 Beserious 阅读(159) 评论(0) 推荐(0) 编辑
58. Length of Last Word
摘要:Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string. If the last word 阅读全文
posted @ 2017-07-20 11:48 Beserious 阅读(94) 评论(0) 推荐(0) 编辑
53. Maximum Subarray
摘要:Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [-2,1,-3,4,-1,2, 阅读全文
posted @ 2017-07-20 08:13 Beserious 阅读(117) 评论(0) 推荐(0) 编辑
38. Count and Say
摘要:The count-and-say sequence is the sequence of integers with the first five terms as following: 1. 1 2. 11 3. 21 4. 1211 5. 111221 1 is read off as "on 阅读全文
posted @ 2017-07-19 21:03 Beserious 阅读(132) 评论(0) 推荐(0) 编辑
35. Search Insert Position
摘要:Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in or 阅读全文
posted @ 2017-07-19 20:08 Beserious 阅读(91) 评论(0) 推荐(0) 编辑
28. Implement strStr()
摘要:Implement strStr(). Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. 字符串Rabin--Karp算法。滚动哈希,时间 阅读全文
posted @ 2017-07-19 19:43 Beserious 阅读(92) 评论(0) 推荐(0) 编辑
27. Remove Element
摘要:Given an array and a value, remove all instances of that value in place and return the new length. Do not allocate extra space for another array, you 阅读全文
posted @ 2017-07-18 16:12 Beserious 阅读(105) 评论(0) 推荐(0) 编辑
26. Remove Duplicates from Sorted Array
摘要:Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. Do not allocate extra space fo 阅读全文
posted @ 2017-07-18 16:00 Beserious 阅读(78) 评论(0) 推荐(0) 编辑
21. Merge Two Sorted Lists
摘要:Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. 注意边界,注意边 阅读全文
posted @ 2017-07-18 15:47 Beserious 阅读(128) 评论(0) 推荐(0) 编辑
20. Valid Parentheses
摘要:Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. The brackets must close in the 阅读全文
posted @ 2017-07-18 13:55 Beserious 阅读(115) 评论(0) 推荐(0) 编辑
14. Longest Common Prefix
摘要:Write a function to find the longest common prefix string amongst an array of strings. 找出,给出的一堆字符串的公共前缀。两个两个比较 阅读全文
posted @ 2017-07-17 20:09 Beserious 阅读(110) 评论(0) 推荐(0) 编辑
13. Roman to Integer
摘要:Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999. 给出罗马数字 输出对应的阿拉伯数字。思路来自29的罗马数字 观看罗马数字构造规则(h 阅读全文
posted @ 2017-07-17 19:36 Beserious 阅读(130) 评论(0) 推荐(0) 编辑
9. Palindrome Number
摘要:Determine whether an integer is a palindrome. Do this without extra space. 就是判断 反转后的整数和反转之前的整数是否相等 阅读全文
posted @ 2017-07-17 16:55 Beserious 阅读(93) 评论(0) 推荐(0) 编辑
7. Reverse Integer
摘要:Reverse digits of an integer. Example1: x = 123, return 321Example2: x = -123, return -321 Note:The input is assumed to be a 32-bit signed integer. Yo 阅读全文
posted @ 2017-07-17 14:45 Beserious 阅读(102) 评论(0) 推荐(0) 编辑
机器学习 面试常见问题
摘要:(1)SVM/LR/GBDT/EM的原理以及公式推导 (2)RF和GDBT的区别;GDBT,XGBOOST的区别,从底层原理去分析 (3)决策树处理连续值方法 (4)解释一下原问题和对偶问题 (5)什么是过拟合,以及解决方案 (6)什么是正则项,L1范式,L2范式区别是什么,各自用在什么地方? (7 阅读全文
posted @ 2017-07-13 22:38 Beserious 阅读(303) 评论(0) 推荐(0) 编辑
ROS人脸检测 使用webcam实现
摘要:github地址https://github.com/ngunauj/facedetection 熟悉ros环境。ubuntu16.04 + ros kinetic版本。使用笔记本自带摄像头,完成人脸的实时检测。代码可能会更改,具体以github上的代码为主。 camera_driver代码 在人脸 阅读全文
posted @ 2017-07-10 15:48 Beserious 阅读(1846) 评论(2) 推荐(0) 编辑
1. Two Sum
摘要:Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have ex 阅读全文
posted @ 2017-07-04 22:21 Beserious 阅读(133) 评论(0) 推荐(0) 编辑