摘要:
Given an array with n objects colored red, white or blue, sort them in-place so that objects of the same color are adjacent, with the colors in the or 阅读全文
摘要:
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sorted f 阅读全文
摘要:
Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in-place. 来源:力扣(LeetCode)链接:https://leetcode-cn.com/problems/set-m 阅读全文
摘要:
Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. Example: Inpu 阅读全文
摘要:
Given a string, find the length of the longest substring without repeating characters. 来源:力扣(LeetCode)链接:https://leetcode-cn.com/problems/longest-subs 阅读全文
摘要:
//原题来自LeetCode 给定一个字符串,返回其中最长的回文子字符串 这道题目前目前受限于能力,暂时只能通过最暴力的解法来求得其解,即遍历子字符串,找出满足条件的解。下面是未曾优化过的代码,超出了时间限制的,囧(96 / 103 个通过测试用例) 这个思路很直接,不过就是要经过几次遍历,耗时太久 阅读全文
摘要:
Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. You may assume that each inp 阅读全文
摘要:
回文串,就是说给出的字符串中的字符是否对称,即:第一个字符与最后一个字符相等,第二个字符等于倒数第二个字符,以此类推,忽略大小写以及标点符号。 e.g: 这段代码运行的时间和占用的内存好像并不稳定,试过提交几次得到的结果都并不相同。在最后的循环判断那里,虽然我只是觉得注释所说的方法所需要的时间更长, 阅读全文