ass673556617的专栏

近期记录一些leetcode上的题目,以及平时遇到的一些问题

Continuous Subarray Sum

Given a list of non-negative numbers and a target integer k, write a function to check if the array has a continuous subarray of size at least 2 that...

2017-09-14 02:14:03

阅读数 108

评论数 0

Predict the Winner

Given an array of scores that are non-negative integers. Player 1 picks one of the numbers from either end of the array followed by the player 2 and ...

2017-09-11 03:52:08

阅读数 145

评论数 0

Maximum Width of Binary Tree

Given a binary tree, write a function to get the maximum width of the given tree. The width of a tree is the maximum width among all levels. The bina...

2017-09-10 04:10:50

阅读数 189

评论数 0

Print Binary Tree

Print a binary tree in an m*n 2D string array following these rules: The row number m should be equal to the height of the given binary tree.The c...

2017-09-09 00:45:47

阅读数 155

评论数 0

Split Array into Consecutive Subsequences

You are given an integer array sorted in ascending order (may contain duplicates), you need to split them into several subsequences, where each subse...

2017-09-06 04:40:47

阅读数 447

评论数 0

Brick Wall

There is a brick wall in front of you. The wall is rectangular and has several rows of bricks. The bricks have the same height but different width. Y...

2017-09-02 04:07:56

阅读数 114

评论数 0

Number Complement

Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation. Note: The g...

2017-09-02 03:14:07

阅读数 97

评论数 0

Reshape the Matrix

In MATLAB, there is a very useful function called 'reshape', which can reshape a matrix into a new one with different size but keep its original data...

2017-09-01 23:36:36

阅读数 130

评论数 0

Solve the Equation

Solve a given equation and return the value of x in the form of string "x=#value". The equation contains only '+', '-' operation, the var...

2017-09-01 06:43:24

阅读数 242

评论数 0

Contiguous Array

Given a binary array, find the maximum length of a contiguous subarray with equal number of 0 and 1. Example 1: Input: [0,1] Output: 2 Explanatio...

2017-09-01 05:52:49

阅读数 99

评论数 0

Distribute Candies

Given an integer array with even length, where different numbers in this array represent different kinds of candies. Each number means one candy of t...

2017-09-01 01:25:18

阅读数 132

评论数 0

Merge Two Binary Trees

Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are ...

2017-09-01 01:13:41

阅读数 95

评论数 0

Two Sum IV - Input is a BST

Given a Binary Search Tree and a target number, return true if there exist two elements in the BST such that their sum is equal to the given target. ...

2017-08-31 13:32:04

阅读数 165

评论数 0

Array Nesting

A zero-indexed array A consisting of N different integers is given. The array contains all integers in the range [0, N - 1]. Sets S[K] for 0 S...

2017-08-31 04:57:15

阅读数 186

评论数 1

Replace Words

In English, we have a concept called root, which can be followed by some other words to form another longer word - let's call this word successor. ...

2017-08-31 04:22:35

阅读数 399

评论数 0

Palindromic Substrings

Given a string, your task is to count how many palindromic substrings in this string. The substrings with different start indexes or end indexes a...

2017-08-31 02:59:16

阅读数 168

评论数 0

Add One Row to Tree

Given the root of a binary tree, then value v and depth d, you need to add a row of nodes with value v at the given depth d. The root node is at ...

2017-08-31 02:22:31

阅读数 139

评论数 0

Most Frequent Subtree Sum

Given the root of a tree, you are asked to find the most frequent subtree sum. The subtree sum of a node is defined as the sum of all the node values...

2017-08-30 08:00:53

阅读数 117

评论数 0

Single Element in a Sorted Array

Given a sorted array consisting of only integers where every element appears twice except for one element which appears once. Find this single elemen...

2017-08-30 06:24:55

阅读数 211

评论数 0

K-diff Pairs in an Array

Given an array of integers and an integer k, you need to find the number of unique k-diff pairs in the array. Here a k-diff pair is defined as an i...

2017-08-30 05:42:26

阅读数 196

评论数 0

提示
确定要删除当前文章?
取消 删除
关闭
关闭