上一页 1 ··· 164 165 166 167 168 169 170 171 172 ··· 273 下一页
摘要: 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 @ 2018-03-28 23:45 bonelee 阅读(259) 评论(0) 推荐(0)
摘要: Given a binary tree, return the tilt of the whole tree. The tilt of a tree node is defined as the absolute difference between the sum of all left subt 阅读全文
posted @ 2018-03-28 22:40 bonelee 阅读(211) 评论(0) 推荐(0)
摘要: 多线程 from:https://www.liaoxuefeng.com/wiki/001374738125095c955c1e6d8bb493182103fac9270762a000/001386832360548a6491f20c62d427287739fcfa5d5be1f000 import 阅读全文
posted @ 2018-03-28 17:02 bonelee 阅读(241) 评论(0) 推荐(0)
摘要: Find the sum of all left leaves in a given binary tree. Example: 更简洁的写法: 迭代解法: 另外也可以在迭代过程中绕过叶子结点: 阅读全文
posted @ 2018-03-27 23:23 bonelee 阅读(222) 评论(0) 推荐(0)
摘要: Given two binary trees, write a function to check if they are the same or not. Two binary trees are considered the same if they are structurally ident 阅读全文
posted @ 2018-03-27 22:55 bonelee 阅读(241) 评论(0) 推荐(0)
摘要: Given an arbitrary ransom note string and another string containing letters from all the magazines, write a function that will return true if the rans 阅读全文
posted @ 2018-03-27 22:36 bonelee 阅读(193) 评论(0) 推荐(0)
摘要: 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 @ 2018-03-27 22:18 bonelee 阅读(209) 评论(0) 推荐(0)
摘要: Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999. Roman Numerals Chart M=1000 D = 500 I 1 XX 阅读全文
posted @ 2018-03-27 21:23 bonelee 阅读(406) 评论(0) 推荐(0)
摘要: import re pattern = re.compile( r'^(([a-zA-Z]{1})|([a-zA-Z]{1}[a-zA-Z]{1})|' r'([a-zA-Z]{1}[0-9]{1})|([0-9]{1}[a-zA-Z]{1})|' r'([a-zA-Z0-9][-_.a-zA-Z0-9]{0,61}[a-zA-Z0-9]))\.' r'([a... 阅读全文
posted @ 2018-03-27 12:01 bonelee 阅读(4841) 评论(0) 推荐(0)
摘要: 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 @ 2018-03-26 23:25 bonelee 阅读(198) 评论(0) 推荐(0)
上一页 1 ··· 164 165 166 167 168 169 170 171 172 ··· 273 下一页