一. 题目描述 Write a function that takes a string as input and returns the string reversed. Example: Given s = "hel…
标签:LeetCode
LeetCode(111)Minimum Depth of Binary Tree
题目描述 Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest …
LeetCode108. Convert Sorted Array to Binary Search Tree
题目描述 Given an array where elements are sorted in ascending order, convert it to a height balanced BST. 题目只有一句话…
LeetCode -[简单]-169. 求众数-Java实现
题目描述: 给定一个大小为 n 的数组,找到其中的众数。众数是指在数组中出现次数大于 ⌊ n/2 ⌋ 的元素。 你可以假设数组是非空的,并且给定的数组总是存在众数。 示例 …
LeetCode -[简单]-14. 最长公共前缀-Java实现
题目描述: 编写一个函数来查找字符串数组中的最长公共前缀。 如果不存在公共前缀,返回空字符串 ""。 示例 1: 输入:[“flower”,”flow”…
27. Remove Element(Java)
Given an array and a value, remove all instances of that value in place and return the new length. Do not allo…
28. Implement strStr() java
Implement strStr(). Returns the index of the first occurrence of needle in haystack, or -1 if needle is not pa…
29. Divide Two Integers(Java)
Divide two integers without using multiplication, division and mod operator. If it is overflow, return MAX_INT…
Leetcode刷题笔记-Tree
105. Construct Binary Tree from Preorder and Inorder Traversal Given preorder and inorder traversal of a …
leetcode刷题笔记-stack
394. Decode String Given an encoded string, return it’s decoded string. The encoding rule is: …
Leetcode刷题笔记,palindromic strings回文
647. Palindromic Substrings 求回文,感觉有点难不知道为什么放在DP,不是用DP解 Given a string, your task is to count how many pal…
leetcode刷题笔记-DFS and BFS
559. Maximum Depth of N-ary Tree easy BFS Given a n-ary tree, find its maximum depth. The maximum depth i…