• 等级
  • 2050 访问
  • 87 原创
  • 0 转发
  • 69498 排名
  • 2 评论
  • 0 获赞

LeetCode-Product_of_Array_Except_Self

题目: Given an array nums of n integers where n > 1,  return an array output such that output[i] is equal to the product of all the elements of nums except nums[i]. Example: Input: [1,2,3,4] Out...

2018-09-21 16:14:10

LeetCode-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 are counted as different substrings even they con...

2018-08-11 16:30:03

LeetCode-Queue_Reconstruction_by_Height

题目: Suppose you have a random list of people standing in a queue. Each person is described by a pair of integers (h, k), where h is the height of the person and k is the number of people in front of ...

2018-08-11 15:04:05

LeetCode-Counting_Bits

题目: Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation and return them as an array. Example 1: Input: ...

2018-08-11 10:53:39

LeetCode-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 not. You need to merge them into a new binary...

2018-08-11 09:51:00

LeetCode-Student_Attendance_Record_I

题目: You are given a string representing an attendance record for a student. The record only contains the following three characters: 'A' : Absent. 'L' : Late. 'P' : Present. A student could be rew...

2018-07-25 08:50:16

LeetCode-Diameter_of_Binary_Tree

题目: Given a binary tree, you need to compute the length of the diameter of the tree. The diameter of a binary tree is the length of the longest path between any two nodes in a tree. This path may or ...

2018-07-24 09:00:56

LeetCode-Reverse_Words_in_a_String_III

题目:Given a string, you need to reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order.Example 1:Input: "Let's take LeetCode contest" Ou...

2018-06-29 09:52:30

C++小技巧

1.利用istringstream将字符串按空格分隔#include<sstream> string s="a b cd efg"; string t=""; istringstream is(s); while(s>>t) cout<<t; //t分别为a,b,cd,efg2.string.pop_back()  删除字符串的最后一个字符string...

2018-06-29 09:47:40

LeetCode-Reverse_String_II

题目:Given a string and an integer k, you need to reverse the first k characters for every 2k characters counting from the start of the string. If there are less than k characters left, reverse all of t...

2018-06-29 09:13:03

LeetCode-Convert_BST_To_Greater_Tree

题目:Given a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is changed to the original key plus sum of all keys greater than the original key in BST.Examp...

2018-06-28 10:05:21

LeetCode-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 integer pair (i, j), where i and j are both numbers...

2018-06-28 09:11:52

LeetCode-Array_Partition_I

题目:Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), ..., (an, bn) which makes sum of min(ai, bi) for all i from 1 to n as large as p...

2018-06-27 10:19:37

LeetCode-Minimum_Absolute_Difference_in_BST

题目:Given a binary search tree with non-negative values, find the minimum absolute difference between values of any two nodes.Example:Input: 1 \ 3 / 2 Output: 1 Explanation: The m...

2018-06-27 10:00:49

LeetCode-Longest_Uncommon_Subsequence_I

题目:Given a group of two strings, you need to find the longest uncommon subsequence of this group of two strings. The longest uncommon subsequence is defined as the longest subsequence of one of these ...

2018-06-26 19:01:53

LeetCode-Detect_Capital

题目:Given a word, you need to judge whether the usage of capitals in it is right or not.We define the usage of capitals in a word to be right when one of the following cases holds:All letters in this w...

2018-06-26 14:26:26

LeetCode-Perfect_Number

题目:We define the Perfect Number is a positive integer that is equal to the sum of all its positive divisors except itself.Now, given an integer n, write a function that returns true when it is a perfe...

2018-06-25 15:24:11

LeetCode-Relative_Ranks

题目:Given scores of N athletes, find their relative ranks and the people with the top three highest scores, who will be awarded medals: "Gold Medal", "Silver Medal" and "Bronze Medal".Example 1:Input: ...

2018-06-25 14:49:17

LeetCode-Base_7

题目:Given an integer, return its base 7 string representation.Example 1:Input: 100 Output: "202" Example 2:Input: -7 Output: "-10" Note: The input will be in range of [-1e7, 1e7].翻译:给定一个数字,返回它的7进制字符串表示...

2018-06-21 10:19:33

LeetCode-Find_Mode_in_Binary_Search_Tree

题目:Given a binary search tree (BST) with duplicates, find all the mode(s) (the most frequently occurred element) in the given BST.Assume a BST is defined as follows:The left subtree of a node contains...

2018-06-20 12:54:00

_TX

关注
  • 中国