-
3表示两道数组easy题用scala刷,报错。他输出了超过我返回数组长度的部分。不知道有没有遇到的小伙伴
-
2还有约刷leetcode吗?有语言和数据结构基础。但是个几乎没刷过题的新人。想要个伙伴讨论促进度。有群或者人吗?
-
3算是官方的中文版么? 账户互通么?
-
3QQ 416486188
-
6我一定是miss了什么重要的算法 又被一道题block了 Given an array A of integers, return the length of the longest arithmetic subsequence in A. 给出一个数组中最长的arithmetic子数组的长度。 解释arithmetic that a sequence B is arithmetic if B[i+1] - B[i] are all the same value (俺的解释:就是从数组中按顺序挑选出的subarray 不用连续,但是前后不能颠倒。 选出来的元素相邻两个的差都是相等的) 看例子最明白 Input: [3,6,9,12] Output: 4 Explanation: The whole array is an arithmetic sequence with steps of length = 3.
-
3一天刷一道medium,感觉好充实,希望互加交流分享
-
3新人求助,哪里选择想要答题的编程语言?
-
3问个问题,我准备做leetcode,比如我的思路是a,做不下去了,或者没有思路,上网查资料,网上的是思路b,与a不一样,这时我是继续我的思路a呢,还是直接用思路b,谢谢
-
3数学建模三天把我身体掏空了一大半。还是刷题好啊。今天先刷一道简单的,养养气势。
-
6有没有大佬能告知一下这个head表示的什么
-
14还差30道,加油~
-
2class Solution: def removeDuplicates(self, nums): """ :type nums: List[int] :rtype: int """ for i in nums: m = nums.count(i) if m != 1: nums.remove(i) return len(nums) 这样错在哪里啊
-
2如题,测试和提交解答等了n年得到内部错误,本地运行没错~
-
1Leetcode刷题Slack群 欢迎萌新大佬入驻,链接长期有效 http://t.cn/R3j62uN
-
1【题目描述】 Write a function that add two numbers A and B. You should not use + or any arithmetic operators. Notice:There is no need to read data from standard input stream. Both parameters are given in function aplusb, you job is to calculate the sum and return it. 给出两个整数a和b, 求他们的和, 但不能使用 + 等数学运算符。 注意:你不需要从输入流读入数据,只需要根据aplusb的两个参数a和b,计算他们的和并返回就行。 【题目链接】 http://www.lintcode.com/en/problem/a-b-problem/ 【题目解析】 直接+没什么好说的,
-
1【题目描述】 Write an algorithm which computes the number of trailing zeros in n factorial. 设计一个算法,计算出n阶乘中尾部零的个数。 【题目链接】 http://www.lintcode.com/en/problem/trailing-zeros/ 【题目解析】 传统解法是首先求出n!,然后计算末尾0的个数。(重复÷10,直到余数非0)该解法在输入的数字稍大时就会导致阶乘得数溢出,不足取。 O(logn)解法:一个更聪明的解法是考虑n!的质数因子。后缀0总是由质因子2和质因子5相乘得来的。如果我们可以计数2和5的个数,
-
4正在上这门课,感觉不错,分享一下,不喜勿喷 https://class.pkbigdata.com/#/classDetail/classIntroduce/3?slxyd
-
1就是以前用中国的ip可以进美国的leetCode,现在就变成这样了,底下啥都没有。现在相当于是锁区啦?
-
1问个问题,我准备做leetcode,比如我的思路是a,做不下去了,或者没有思路,上网查资料,网上的是思路b,与a不一样,这时我是继续我的思路a呢,还是直接用思路b,谢谢
-
12
-
7
-
1有没有想加入leetcode.刷题的,求举手
-
1定义多个类(至少两个),设计一些函数对每个类进行一些操作,比如生成类对象,赋值,传递参数,返回类对象等等,并设计一种办法能够自动统计出每个类的构造函数、析构函数、和拷贝构造函数各调用了多少次,在main函数的最后输出这些统计数值。
-
3有没有用c刷题的大神,小白有好多东西不懂,想请教,或者有什么群也好呀,嘿嘿
-
1最近两天换了几台机器,leetcode都登不上去,求解
-
7甚至很多hard题也可以暴力过,这样如何体现编程之美呢?
-
2刚刚还在写着题,提交发现提交不了,现在网页也打不开了。。。
-
3为什么访问不了了呢?
-
27easy级别,再把题目梳理一下 437. Path Sum IIIEasy You are given a binary tree in which each node contains an integer value. 给你一二叉树,每个节点的值都是整数。 Find the number of paths that sum to a given value. 找到又几种路径其中节点的和等于给定的值。 The path does not need to start or end at the root or a leaf, but it must go downwards(traveling only from parent 路径不必从根节点到叶子节点。但是必须是从上到下。也就是需要从父节点到字节的的顺序。 nodes to child nodes). The tree has no more than 1,000 nodes
-
5等一下又可以访问,是萨满原因啊????
-
11比赛系统崩了?
-
3估计没人来捧场
-
2leetcode在验证邮箱时收不到验证用的E-mail是怎么回事?
-
4class Solution { public: ListNode* addTwoNumbers(ListNode* l1, ListNode* l2) { int temp = 0; ListNode* l3 = NULL; ListNode* p = l3; while(l1&&l2) //遍历两个链表 { int sum = l1->val + l2->val + temp; temp = sum / 10; ListNode* l3_ptr = new ListNode(sum % 10); if(l3 == NULL) { l3 = l3_ptr; p = l3; } p->next = l3_ptr; p = p->next; l1 = l1->next; l2 = l2->next; } while(l1) //如果l2为空,遍历l1 { int sum = l1->val + temp; temp = sum / 10; ListNode* l3_ptr = new ListNode(sum % 10); if(l3 == NULL) { l3 = l3_ptr; p = l3; } p->next = l3_ptr; p = p->next;
-
2Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the length is 3. For "bbbbb" the longest substring is "b", with the length of 1. public class Solution { public int lengthOfLongestSubstring(String s) { int len=s.length(); int max=0; if(len==0) return 0; if(len==1) return 1; for(int i=0;i<len;i++){ for(int j=i+1;j<len;j++){ if(s.charAt(i)==s.charAt(j)) { break;} else if(max<j-i){ max=j-i; } } } return max; } }
-
4public ListNode deleteDuplicates(ListNode head) { if(head==null||head.next==null) throw new IllegalArgumentException("the number of nodes must be more than one."); ListNode head0=head; ListNode cur=head0.next ; if(head0==cur){ head0=cur; } while(cur.next!=null){ System.out.println(cur); if(cur==cur.next){ ListNode node=cur.next; cur.next=node.next; node.next=null; }else cur=cur.next; } return head0; } 方法运行链表不变化 啊
-
3C++代码只能写在他提供的类里吗?还需要自己写一个main函数吗? 刚刚使用leetcode,不了解他们的规定。大神帮助帮助。感激不尽!
-
3水题求解~Runtime Error LeetCode — 338. Counting Bits 来源:直接搜338. Counting Bits,放链接度娘吞了。。。。 介绍: Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1’s in their binary representation and return them as an array. Example:For num = 5 you should return [0,1,1,2,1,2]. Follow up: It is very easy to come up with a solution with run time O(n*sizeof(integer)). But can you do it in linear time O(n) /possibly in a single pass? Space complexity should be O(n). 我的代码,输入8时,回报Ru
-
1来源: https://leetcode.com/problems/counting-bits/ 介绍: Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1’s in their binary representation and return them as an array. Example:For num = 5 you should return [0,1,1,2,1,2]. Follow up: It is very easy to come up with a solution with run time O(n*sizeof(integer)). But can you do it in linear time O(n) /possibly in a single pass? Space complexity should be O(n). 我的代码,输入8时,回报Runtime Error的错误,但是打印的结果是正确的: int* countBits(in
-
9开始在leetcode刷题,开个贴记录一下我的答案和进度。
-
3原题链接https://leetcode.com/problems/remove-duplicate-letters/ 原题为: Given a string which contains only lowercase letters, remove duplicate letters so that every letter appear once and only once. You must make sure your result is the smallest in lexicographical order among all possible results. 里面的the smallest in lexicographical order among all possible results.是什么意思
-
6Question : Implement atoi to convert a string to an integer. Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input cases. Notes: It is intended for this problem to be specified vaguely (ie, no given input specs). You are responsible to gather all the input requirements up front. 该题看上去很简单,其实有很多边界条件需要考虑,比如负数、空格、正溢出、负溢出等等,二楼上代码
-
2为什么我不能直接用node=node.next赋值?
-
3在leetcode申请付费会员,然后要填写卡信息,我用的中国工商银行的工银灵通卡,提示this card was desclined,怎么办