Given a binary array, find the maximum length of a contiguous subarray with equal number of 0 and 1. Ex…
分类:LeetCode
力扣(LeetCode)417
题目地址:https://leetcode-cn.com/probl…题目描述:给定一个 m x n 的非负整数矩阵来表示一片大陆上各个单元格的高度。“太平洋”处于大陆的左边界和上边界,而“大西洋”处于大陆的…
LeetCode | Merge k Sorted Lists(归并k个链表)
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 将…
LeetCode [448. Find All Numbers Disappeared in an Array] 难度[easy]
题目 Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others ap…
Leetcode513. Find Bottom Left Tree Value
Given a binary tree, find the leftmost value in the last row of the tree Basic idea: I use two global variable…
[Leetcode]16. 最接近的三数之和
给定一个包括 n 个整数的数组 nums 和 一个目标值 target。找出 nums 中的三个整数,使得它们的和与 target 最接近。返回这三个数的和。假定每组输入只存在唯一答案。 例如,给定数组 nums = […
Day4. Search Insert Position(35)
问题描述 Given a sorted array and a target value, return the index if the target is found. If not, return the inde…
[LeetCode] Ternary Expression Parser 三元表达式解析器
Given a string representing arbitrarily nested ternary expressions, calculate the result of the express…
207. Course Schedule
There are a total of n courses you have to take, labeled from 0 to n-1. Some courses may have prerequisites, f…
[Leetcode] Read N Characters Given Read4 用Read4 API读取N个字符
Read N Characters Given Read4 I The API: int read4(char *buf) reads 4 characters at a time from a file. The re…
[Leetcode] Same Tree Symmetric Tree 相同树 对称树
Same Tree Given two binary trees, write a function to check if they are equal or not. Two binary trees are con…
c++并查集配合STL MAP的实现(洛谷P2814题解)
不会并查集的话请将此文与我以前写的并查集一同食用。 原题来自洛谷 原题 文字稿在此: 题目背景 现代的人对于本家族血统越来越感兴趣。 题目描述 给出充足的父子关系,请你编写程序找到某个人的最早的祖先。 输入输出格式 输入…