上一页 1 ··· 60 61 62 63 64 65 66 67 68 ··· 77 下一页
摘要: [抄题]: Given a nested list of integers, return the sum of all integers in the list weighted by their depth. Each element is either an integer, or a lis 阅读全文
posted @ 2018-03-12 10:58 苗妙苗 阅读(422) 评论(0) 推荐(0)
摘要: [抄题]: Given an array where elements are sorted in ascending order, convert it to a height balanced BST. For this problem, a height-balanced binary tre 阅读全文
posted @ 2018-03-12 09:21 苗妙苗 阅读(179) 评论(0) 推荐(0)
摘要: [抄题]: 求最多的联通的1的数量 Given a non-empty 2D array grid of 0's and 1's, an island is a group of 1's (representing land) connected 4-directionally (horizonta 阅读全文
posted @ 2018-03-11 21:25 苗妙苗 阅读(176) 评论(0) 推荐(0)
摘要: [抄题]: Given a binary tree, return all root-to-leaf paths. For example, given the following binary tree: All root-to-leaf paths are: [暴力解法]: 时间分析: 空间分析 阅读全文
posted @ 2018-03-11 11:20 苗妙苗 阅读(176) 评论(0) 推荐(0)
摘要: [抄题]: 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 阅读全文
posted @ 2018-03-11 10:52 苗妙苗 阅读(147) 评论(0) 推荐(0)
摘要: [抄题]: 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 阅读全文
posted @ 2018-03-11 09:39 苗妙苗 阅读(245) 评论(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 阅读全文
posted @ 2018-03-11 09:00 苗妙苗 阅读(141) 评论(0) 推荐(0)
摘要: [抄题]: 对于一个给定的 source 字符串和一个 target 字符串,你应该在 source 字符串中找出 target 字符串出现的第一个位置(从0开始)。如果不存在,则返回 -1。 如果 source = "source" 和 target = "target",返回 -1。 如果 so 阅读全文
posted @ 2018-03-10 21:55 苗妙苗 阅读(162) 评论(0) 推荐(0)
摘要: [抄题]: 设计一种方式检查一个链表是否为回文链表。1->2->1 就是一个回文链表。 [暴力解法]: 时间分析: 空间分析: [思维问题]: 以为要从从后往前扫描,不知道调用reverse函数。其实找中点、翻转都是链表中直接能用的API [一句话思路]: 后半截儿反过来以后,相同就同时走。走到头说 阅读全文
posted @ 2018-03-10 19:40 苗妙苗 阅读(170) 评论(0) 推荐(0)
摘要: [抄题]: Remove all elements from a linked list of integers that have value val. ExampleGiven: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6Return: 1 -- 阅读全文
posted @ 2018-03-10 09:21 苗妙苗 阅读(296) 评论(0) 推荐(0)
上一页 1 ··· 60 61 62 63 64 65 66 67 68 ··· 77 下一页