摘要: Problem Description: Given a binary tree, flatten it to a linked list in-place. For example, given the following tree: The flattened tree should look 阅读全文
posted @ 2019-06-03 15:47 起点菜鸟 阅读(123) 评论(0) 推荐(0) 编辑
摘要: 问题描述:求1+2+3+...+n,要求不能使用乘除法、for、while、if、else、switch、case等关键字及条件判断语句(A?B:C)。 题解:采用递归算法,利用短路机制来解决终止条件的问题 阅读全文
posted @ 2019-05-24 21:32 起点菜鸟 阅读(344) 评论(0) 推荐(0) 编辑
摘要: Problem description: Given an integer array A, you partition the array into (contiguous) subarrays of length at most K. After partitioning, each subar 阅读全文
posted @ 2019-05-12 15:39 起点菜鸟 阅读(569) 评论(0) 推荐(0) 编辑
摘要: Problem description: Given an input string , reverse the string word by word. Example: Input: ["t","h","e"," ","s","k","y"," ","i","s"," ","b","l","u" 阅读全文
posted @ 2019-04-22 10:52 起点菜鸟 阅读(161) 评论(0) 推荐(0) 编辑
摘要: Problem Description: Implement the StreamChecker class as follows: StreamChecker(words): Constructor, init the data structure with the given words. qu 阅读全文
posted @ 2019-04-21 20:25 起点菜鸟 阅读(830) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, find the largest subtree which is a Binary Search Tree (BST), where largest means subtree with largest number of nodes in it. Not 阅读全文
posted @ 2019-04-20 13:04 起点菜鸟 阅读(233) 评论(0) 推荐(0) 编辑
摘要: Assume you have an array of length n initialized with all 0's and are given kupdate operations. Each operation is represented as a triplet: [startInde 阅读全文
posted @ 2019-04-17 10:06 起点菜鸟 阅读(286) 评论(0) 推荐(0) 编辑
摘要: 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 @ 2019-04-16 11:05 起点菜鸟 阅读(243) 评论(0) 推荐(0) 编辑
摘要: Problem Description: Given a binary array, find the maximum length of a contiguous subarray with equal number of 0 and 1. 题解: 这个题很容易想到复杂度为O(n^2)的暴力方法。 阅读全文
posted @ 2019-03-29 17:00 起点菜鸟 阅读(117) 评论(0) 推荐(0) 编辑
摘要: Problem Description: Your are given an array of positive integers nums. Count and print the number of (contiguous) subarrays where the product of all 阅读全文
posted @ 2019-03-29 14:05 起点菜鸟 阅读(139) 评论(0) 推荐(0) 编辑