摘要:https://leetcode.com/problems/isomorphic-strings/ Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic if the chara
阅读全文
随笔分类 - LeetCode
摘要:https://leetcode.com/problems/bitwise-and-of-numbers-range/ 解题思路: 先硬来,超时。 看大神的解法,结论是这道题其实就是要找m和n的bit common prefix。而不需要从m一直算到n。 The hardest part of th
阅读全文
摘要:https://leetcode.com/problems/rotate-array/ Given an array, rotate the array to the right by k steps, where k is non-negative. Example 1: Example 2: N
阅读全文
摘要:https://leetcode.com/problems/repeated-dna-sequences/ All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACGA
阅读全文
摘要:https://leetcode.com/problems/two-sum-ii-input-array-is-sorted/ Given an array of integers that is already sorted in ascending order, find two numbers
阅读全文
摘要:https://leetcode.com/problems/convert-bst-to-greater-tree/ Given a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the o
阅读全文
摘要:https://leetcode.com/problems/uncommon-words-from-two-sentences We are given two sentences A and B. (A sentence is a string of space separated words.
阅读全文
摘要:https://leetcode.com/problems/path-sum-iii You are given a binary tree in which each node contains an integer value. Find the number of paths that sum
阅读全文
摘要:https://leetcode.com/problems/delete-node-in-a-bst Given a root node reference of a BST and a key, delete the node with the given key in the BST. Retu
阅读全文
摘要:https://leetcode.com/problems/sliding-window-maximum/ Given an array nums, there is a sliding window of size k which is moving from the very left of t
阅读全文
摘要:https://leetcode.com/problems/find-k-closest-elements/description/ Given a sorted array, two integers k and x, find the k closest elements to x in the
阅读全文
摘要:https://leetcode.com/problems/same-tree/Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equ...
阅读全文
摘要:https://leetcode.com/problems/delete-node-in-a-linked-list/Write a function to delete a node (except the tail) in a singly linked list, given only acc...
阅读全文
摘要:https://leetcode.com/problems/maximum-depth-of-binary-tree/Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along ...
阅读全文
摘要:https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-search-tree/ Given a binary search tree (BST), find the lowest common ancestor (LCA)
阅读全文
摘要:https://leetcode.com/problems/palindrome-linked-list/ Given a singly linked list, determine if it is a palindrome. Follow up:Could you do it in O(n) t
阅读全文
摘要:https://leetcode.com/problems/kth-smallest-element-in-a-bst/ Given a binary search tree, write a function kthSmallest to find the kth smallest element
阅读全文
摘要:https://leetcode.com/problems/excel-sheet-column-title/Given a positive integer, return its corresponding column title as appear in an Excel sheet.For...
阅读全文
摘要:https://leetcode.com/problems/majority-element-ii/Given an integer array of sizen, find all elements that appear more than⌊ n/3 ⌋times. The algorithm ...
阅读全文
摘要:https://leetcode.com/problems/number-of-1-bits/Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known a...
阅读全文

浙公网安备 33010602011771号