You are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of nums2. Find…
分类:LeetCode
811. Subdomain Visit Count
原文地址:https://leetcode.com/problems/subdomain-visit-count/description/ 大意:本题比较繁琐。类似于分类然后算加减法。 class Solution: d…
265. Paint House II
FB Tag Hard 最基本的方法是开一个2d dp array, dp[i][j]这里表示的是当第i个房子是j color时所需要的最小花费,所以我们最后要得到的是k个dp[n – 1][k]中的最小值.…
Leetcode 166. Fraction to Recurring Decimal
Given two integers representing the numerator and denominator of a fraction, return the fraction in string for…
[LeetCode] Combination Sum 组合之和,Path Sum II,Subsets II,Permutations,Permutations II,Combinations
Given a set of candidate numbers (candidates) (without duplicates) and a target num…
[LeetCode] Intersection of Two Linked Lists 求两个链表的交点
Write a program to find the node at which the intersection of two singly linked lists begins. Fo…
[LeetCode] Find All Anagrams in a String 找出字符串中所有的变位词
Given a string s and a non-empty string p, find all the start indices of …
[LeetCode] Smallest Good Base 最小的好基数
For an integer n, we call k>=2 a good base of n, if all digits of n base k are 1. Now given a string…
LeetCode | Longest Substring Without Repeating Characters
题目: Given a string, find the length of the longest substring without repeating characters. For example, the lo…
LeetCode算法题-Diameter of Binary Tree(Java实现)
这是悦乐书的第257次更新,第270篇原创 01 看题和准备 今天介绍的是LeetCode算法题中Easy级别的第124题(顺位题号是543)。给定二叉树,您需要计算树的直径长度。 二叉树的直径是树中任意两个节点之间最长…
686. Repeated String Match
Easy Given two strings A and B, find the minimum number of times A has to be repeated such that B is a substri…
270. Closest Binary Search Tree Value
Easy 这道题mock的时候没做出来,老师说这种送分题应该是几分钟就写好的,我汗。 recursive way /** * Definition for a binary tree node. * public cla…