问题描述 Given an array of integers, every element appears twice except for one. Find that single one. 思路:利用0和任何数异…
标签:LeetCode
LeetCode刷题之Search Insert Position
Problem Given a sorted array and a target value, return the index if the target is found. If not, return the i…
滑动窗口的最大值
题目描述 给定一个数组和滑动窗口的大小,找出所有滑动窗口里数值的最大值。例如,如果输入数组{2,3,4,2,6,2,5,1}及滑动窗口的大小3,那么一共存在6个滑动窗口,他们的最大值分别为{4,4,6,6,6,5}; 针…
LeetCode算法题-Contains Duplicate II(Java实现)
这是悦乐书的第193次更新,第197篇原创 01 看题和准备 今天介绍的是LeetCode算法题中Easy级别的第53题(顺位题号是219)。给定整数数组和整数k,找出数组中是否存在两个不同的索引i和j,使得nums […
LeetCode算法题-Intersection of Two Arrays II(Java实现)
这是悦乐书的第208次更新,第220篇原创 01 看题和准备 今天介绍的是LeetCode算法题中Easy级别的第76题(顺位题号是350)。给定两个数组,编写一个函数来计算它们的交集。例如: 输入:nums1 = [1…
binary-tree-postorder-traversal
title: binary-tree-postorder-traversal 描述 Given a binary tree, return the postorder traversal of its nodesR…
二刷297. Serialize and Deserialize Binary Tree
Hard 这道题给的例子我一眼看去觉得是Level Order在做遍历,所以索性就用层级遍历做吧。在deserialize那块index的问题上纠结了很长时间,仍然不是很确定 /** * Definition for a…
Leetcode 228. Summary Ranges
Given a sorted integer array without duplicates, return the summary of its ranges. Example 1: Input: [0,1,2,4,…
298. Binary Tree Longest Consecutive Sequence
/* * 298. Binary Tree Longest Consecutive Sequence My Submissions QuestionEditorial Solution Total Accepted: 9…
2018-05-12 633. Sum of Square Numbers
题意:给你一个非负数c,判断该数是不是两个完全平方数的和(a^2 + b^2) = c. 解题思路: 思路一:暴力。筛选a,b:a^2 <= c, b ^2 <= c,然后组合a^2 + b^2与c比较,时间…
[array] leetCode-15. 3Sum-Medium
leetCode-15. 3Sum-Medium descrition Given an array S of n integers, are there elements a, b, c in S such that …
283. Move Zeroes
描述 Given an array nums, write a function to move all 0’s to the end of it while maintaining the relative…