我的解决方案:处理一下溢出问题就OK了class Solution { public static int mySqrt(int x) { if(x==0) return 0; if(x<4) return 1; for(int i=0;i<=x/2;i++) { //if(i==46340) Sy...
原创 2021-06-29 13:58:45
166阅读
LeetCode
原创 2021-07-19 17:15:39
60阅读
class Solution { public int strStr(String haystack, String needle) { int i = 0, j = 0; int a = haystack.length(); int b = needle.length(); if(a<b) ret
转载 2018-10-05 23:37:00
65阅读
2评论
LeetCode 第一题:两数之和 思路:首先会想到暴力解题,遍历数组中的每个数,找出符合条件的返回即可。 用到for循环和if语句,以下为代码: class Solution { public int[] twoSum(int[] nums, int target) { int n = nums. ...
转载 2021-08-26 18:46:00
149阅读
2评论
没事可以刷刷leetCode https://leetcode.com/
转载 2018-08-26 17:04:00
53阅读
2评论
Implement Queue using StacksImplement the following operations of a queue using stacks. push(x) – Push element x to the back of queue.pop() – Removes
转载 2019-02-20 18:04:00
57阅读
2评论
我的解决方案:处理一下溢出问题就OK了class Solution { public static int mySqrt(int x) { if(x==0) return 0; if(x<4) return 1; for(int i=0;i<=x/2;i++) { //if(i==46340) System.out.
原创 2022-02-28 13:49:49
39阅读
LeetCode
原创 2022-03-29 14:47:18
106阅读
目录二分法细节1、leetcode 34 在排序数组中查找元素的第一个和最后一个位置2、不完全有序下的二分查找(leetcode33. 搜索旋转排序数组)
简单844. 比较含退格的字符串(栈)925. 长按键入 (字符串比较)普通143. 重排链表(转化成线性表)困难
原创 2021-08-31 13:41:36
144阅读
LeetCode-HOT-100力扣 (LeetCode) ?LeetCode 热题 HOT 100  ⚡ ? 如果你有问题​​https://webvueblog.github.io/LeetCode-HOT-100/​​1. 两数之和2. 两数相加3. 无重复字符的最长子串4. 寻找两个正序数组的中位数5. 最长回文子串10. 正则表达式匹配11. 盛最多水的容器15. 三数之和17
原创 6月前
15阅读
/** * 暴力解法 * 1.创建数组,存放所有的请求 * 整型数组,存放10000个元素 * 2.把当前请求存入数组 * 记录最后一次存入的索引,从0开始 * 3.统计距离此次请求前3000毫秒之间的请求次数 * 从最后一次存放位置倒序遍历 * * @param t 时长为 t(单位:毫秒) 的请
转载 2021-08-01 19:34:00
164阅读
2评论
Leetcode分类 题解,持续更新… 文章目录Leetcode分类 题解,持续更新.....一、基础1. 水题2. 位运算3. 区间问题二、数据结构1. 基础数据结构1.1 栈1.2 链表1.3 队列2. 树2.1 二叉树三、算法1. 动态规划2. 贪心3. 排序 一、基础 1. 水题 925. 长按键入 (字符串比较) 1207. 独一无二的出现次数 (水题,击败100% 用户时间!) 1365. 有多少小于当前数字的数字(排序预处理,线性求解) 2. 位运算 234. 回文链表 (异或法求解,空间复
原创 2021-08-31 13:40:01
247阅读
LeetCode 刷题 APP LeetCode 题解 App
转载 2020-09-16 20:55:00
301阅读
2评论
public class Solution {     public List<List<Integer>> subsets(int[] S) {          &nbsp
原创 2015-01-30 16:20:15
344阅读
孔旭真的51CTO博客。www.leetcode.com的online judge中151道算法题目。
转载 精选 2016-10-25 17:00:19
645阅读
现:class Solution: def isPalindrome(self, x: int) -> bool: s = str(x) if s==s[::-1
int rob(int* nums, int numsSize){ if (!numsSize) return 0; if (numsSize>1 && nums[0]>nums[1]) nums[1]=nums[0]; for (int i=2; i<numsSize; i++) { if (nu
转载 2020-09-26 12:34:00
30阅读
2评论
1 class Solution: 2 def findSolution(self, customfunction: 'CustomFunction', z: int) -> List[List[int]]: 3 x,y = 1,1001 4 res = [] 5 while x < 1001 and y > 0
转载 2019-10-30 10:08:00
48阅读
  • 1
  • 2
  • 3
  • 4
  • 5