摘要:
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 阅读全文
摘要:
问题描述:求1+2+3+...+n,要求不能使用乘除法、for、while、if、else、switch、case等关键字及条件判断语句(A?B:C)。 题解:采用递归算法,利用短路机制来解决终止条件的问题 阅读全文
摘要:
Problem description: Given an integer array A, you partition the array into (contiguous) subarrays of length at most K. After partitioning, each subar 阅读全文
摘要:
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" 阅读全文
摘要:
Problem Description: Implement the StreamChecker class as follows: StreamChecker(words): Constructor, init the data structure with the given words. qu 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文
摘要:
Problem Description: Given a binary array, find the maximum length of a contiguous subarray with equal number of 0 and 1. 题解: 这个题很容易想到复杂度为O(n^2)的暴力方法。 阅读全文
摘要:
Problem Description: Your are given an array of positive integers nums. Count and print the number of (contiguous) subarrays where the product of all 阅读全文