返回顶部

随笔分类 -  Leetcode

记录下自己在Leetcode刷题的历程吧
摘要: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 n 阅读全文
posted @ 2019-07-26 01:32 Swetchine 阅读(131) 评论(0) 推荐(0)
摘要:Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree [1,2,2,3,4,4,3] is symmet 阅读全文
posted @ 2019-07-25 00:26 Swetchine 阅读(136) 评论(0) 推荐(0)
摘要:Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. Given an array of size  阅读全文
posted @ 2019-07-14 22:47 Swetchine 阅读(123) 评论(0) 推荐(0)
摘要:Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Given an array of integers where 阅读全文
posted @ 2019-07-14 21:14 Swetchine 阅读(118) 评论(0) 推荐(0)
摘要:Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements. Given an array n 阅读全文
posted @ 2019-07-13 14:27 Swetchine 阅读(113) 评论(0) 推荐(0)
摘要:You are given coins of different denominations and a total amount of money. Write a function to compute the number of combinations that make up that a 阅读全文
posted @ 2019-07-10 01:01 Swetchine 阅读(193) 评论(0) 推荐(0)
摘要:Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward. Example 1: Example 2: Example 3: 阅读全文
posted @ 2019-07-10 00:51 Swetchine 阅读(128) 评论(0) 推荐(0)
摘要:Invert a binary tree. Example: Input: Output: 方法2:递归求解,简洁的让人觉得可怕,跑的还飞快,推荐食用👍 阅读全文
posted @ 2019-07-10 00:31 Swetchine 阅读(185) 评论(0) 推荐(0)
摘要:We have an array A of integers, and an array queries of queries. For the i-th query val = queries[i][0], index = queries[i][1], we add val to A[index] 阅读全文
posted @ 2019-07-09 01:31 Swetchine 阅读(144) 评论(0) 推荐(0)
摘要:Given an array A of integers, for each integer A[i] we may choose any x with -K <= x <= K, and add x to A[i]. After this process, we have some array B 阅读全文
posted @ 2019-07-09 01:20 Swetchine 阅读(130) 评论(0) 推荐(0)