上一页 1 2 3 4 5 6 7 8 ··· 12 下一页
摘要: class Solution { public: int findLHS(vector& nums) { int res=0; map m; for(auto num:nums) ++m[num]; for(auto a:m){ if (m.count(a.first+1)){ ... 阅读全文
posted @ 2018-10-01 19:11 hopskin1 阅读(174) 评论(0) 推荐(0) 编辑
摘要: class Solution(object): def numRabbits(self, answers): """ :type answers: List[int] :rtype: int """ dict={} for x in answers: if x in d... 阅读全文
posted @ 2018-09-02 10:12 hopskin1 阅读(120) 评论(0) 推荐(0) 编辑
摘要: c++代码 判断两个线段是否重复。 fast-rcnn目标检测中nms代码中有这个代码段:) Implement a MyCalendar class to store your events. A new event can be added if adding the event will no 阅读全文
posted @ 2018-07-08 21:16 hopskin1 阅读(111) 评论(0) 推荐(0) 编辑
摘要: 这是leetcode邮件推送的题目,bug-free的代码还是需要debug一段时间的 Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as follo 阅读全文
posted @ 2018-07-08 20:52 hopskin1 阅读(97) 评论(0) 推荐(0) 编辑
摘要: 565. Array Nesting A zero-indexed array A of length N contains all integers from 0 to N-1. Find and return the longest length of set S, where S[i] = { 阅读全文
posted @ 2018-07-08 20:40 hopskin1 阅读(114) 评论(0) 推荐(0) 编辑
摘要: 柠檬水🍋找零问题,有5 10 20三种面值。解法:能用10元找零就不用5块。 At a lemonade stand, each lemonade costs $5. Customers are standing in a queue to buy from you, and order one 阅读全文
posted @ 2018-07-08 20:22 hopskin1 阅读(243) 评论(0) 推荐(0) 编辑
摘要: 判断一棵树里是否有两个节点的值之和等于某个值。 653. Two Sum IV - Input is a BST Given a Binary Search Tree and a target number, return true if there exist two elements in th 阅读全文
posted @ 2018-07-08 17:13 hopskin1 阅读(107) 评论(0) 推荐(0) 编辑
摘要: 这是程序员面试金典里面的一个题目。判断B是否是A旋转得到的,只要判断B是否是A+A的字串即可。 阅读全文
posted @ 2018-07-08 16:57 hopskin1 阅读(71) 评论(0) 推荐(0) 编辑
摘要: We are given head, the head node of a linked list containing unique integer values. We are also given the list G, a subset of the values in the linked 阅读全文
posted @ 2018-07-06 01:46 hopskin1 阅读(184) 评论(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-06 01:30 hopskin1 阅读(107) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 ··· 12 下一页