Medium 不知道做过多少回了,有时还是会出一些小bug. 详细讲解:https://www.youtube.com/watch?v=XSmgFKe-XYU public class Solution { public…
分类:LeetCode
Leetcode - Maximum Product of Word Lengths
My code: public class Solution { public int maxProduct(String[] words) { int max = 0; int len = words.length; …
255. Verify Preorder Sequence in Binary Search Tre
/* * 255. Verify Preorder Sequence in Binary Search Tree Total Accepted: 8634 Total Submissions: 23097 Difficu…
[LeetCode By Go 77]53. Maximum Subarray
题目 Find the contiguous subarray within an array (containing at least one number) which has the largest sum. Fo…
[LeetCode] Palindrome Partitioning 拆分回文串
Given a string s, partition s such that every substring of the partition is a palindrome…
[LeetCode] Guess Number Higher or Lower 猜数字大小
We are playing the Guess Game. The game is as follows: I pick a number from 1 to n. You …
[Leetcode] Pow(x, n) 实现乘方函数
Pow(x, n) Implement pow(x, n) 递归法 复杂度 时间 O(logN) 空间 O(logN) 思路 通过一点点数学推导我们可以知道,如果n是偶数$$ x^nx^n = x^{2n}$$如果n是奇…
LeetCode439. Ternary Expression Parser
Given a string representing arbitrarily nested ternary expressions, calculate the result of the expression. Yo…
C++ - leetcode中级算法题(一)
前言 如果编程只是重复敲一些没有价值代码, 那不是我所向往的编程生活。 如果生活只是重复做一些没有枯燥无味的事情, 那不是我所向往的生活。 所以,我们始终要为心底坚持的美好而努力。 本篇目录 两数相加 无重复字符的最长子…
Leetcode - Valid Number
My code: public class Solution { public boolean isNumber(String s) { int i = 0; int e = s.length() - 1; while …
[LeetCode By Go 73]437. Path Sum III
题目 You are given a binary tree in which each node contains an integer value. Find the number of paths that sum…
[LeetCode] Maximum Subarray 最大子数组
Find the contiguous subarray within an array (containing at least one number) which has the largest sum…