https://i.ancii.com/heray1990/
以leetcode刷题思路为主
题目给了一组 数字,让我们组成一个最大数返回。 从example 2 看出,排序不是按照一般的大小,而是按照搭配组合,比较大小后才得出结果。 3, 30 的结果是 330 大于 303, 所以 3 要排序在 30 之前。 建立一个cutom co
Given a binary treeroot, a nodeXin the tree is namedgoodif in the path from root toXthere are no nodes with a valuegreater thanX
在一个火车旅行很受欢迎的国度,你提前一年计划了一些火车旅行。在接下来的一年里,你要旅行的日子将以一个名为?每一项是一个从?一张为期三十天的通行证售价为?通行证允许数天无限制的旅行。中列出的每一天的旅行所需要的最低消费。在第 1 天,你花了 costs[0]
Given a 2D grid consists of 0s and 1s . An island is a maximal 4-directionally connected group of 0s and a closed island is an
Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.给定一个字符串 s,找到
这次终于四题全过了。
Given am * ngrid, where each cell is either0or1.In one step, you can move up, down, left or right from and to an empty cell.Retu
n = 数组大小 ) 的 整型数组,数组中的元素一些出现了两次,另一些只出现一次。找到所有在 [1, n] 范围之间没有出现在数组中的数字。您能在不使用额外空间且时间复杂度为 O的情况下完成这个任务吗?你可以假定返回的数组不算在额外空间内。这一题和Leet
给定一个数组 nums,编写一个函数将所有 0 移动到数组的末尾,同时保持非零元素的相对顺序。必须在原数组上操作,不能拷贝额外的数组。尽量减少操作次数。 index标识非零的个数,循环遍历数组;如果不是0,就将非零的值移到index位,index加一;遍
Given an array of stringsproductsand a stringsearchWord. We want to design a system that suggests at most three product names fr
Find the length of the longest substringTof a given string such that every character inTappears no less thanktimes.The longest
X is a good number if after rotating each digit individually by 180 degrees, we get a valid number that is different from X. Eac
On a 2 dimensional grid withRrows andCcolumns, we start atfacing east.Here, the north-west corner of the grid is at thefirst row
In a town, there areNpeople labelled from1toN. There is a rumor that one of these people is secretly the town judge.There is exa
Given a matrix of M x N elements , return all elements of the matrix in diagonal order as shown in the below image.The total num
In a given arraynumsof positive integers, find three non-overlapping subarrays with maximum sum.Each subarray will be of sizek,
You are given a stringscontaining lowercase letters and an integerk. You need to :. First, change some characters ofsto other lo
解法二一开始打算使用$3^{log_3N}== N$,来判断是否是3的幂,利用的是取整后去尾,再还原。C语言中log是以e为底的对数,计算时精度丢失严重,建议用以10为底的对数log10.class {public: bool isPowerOfT
First Missing PositiveIDE: C++ author : MinRamcreate : 03/19/2019update: 03/19/2019题目First Missing Positive - LeetCode. G
给定一个字符串,找到没有重复字符的最长子串,返回它的长度。解法一简单粗暴些,找一个最长子串,那么我们用两个循环穷举所有子串,然后再用一个函数判断该子串中有没有重复的字符。for //之所以 j<= n,是因为我们子串是 [i,j),左闭右开。if
0 关注 0 粉丝 0 动态
Copyright © 2013 - 2019 Ancii.com
京ICP备18063983号-5 京公网安备11010802014868号