ICode9

精准搜索请尝试: 精确搜索
  • Lintcode 二分查找2022-07-14 07:31:08

    14 · 二分查找 算法 简单 通过率39%   题目 题解 笔记 讨论 排名 描述 给定一个排序的整数数组(升序)和一个要查找的整数 target,用O(logn)O(logn)的时间查找到target第一次出现的下标(从0开始),如果target不存在于数组中,返回-1。 样例 样例

  • [LintCode] 1375. Substring With At Least K Distinct Characters2022-06-25 09:01:15

    Given a string S with only lowercase characters. Return the number of substrings that contains at least k distinct characters. Example 1: Input: S = "abcabcabca", k = 4 Output: 0 Explanation: There are only three distinct characters in the

  • [LintCode] 1844. subarray sum equals to k II2022-06-23 04:33:50

    Given an array of integers and an integer k, you need to find the minimum size of continuous no-empty subarrays whose sum equals to k, and return its length. if there are no such subarray, return -1. Example1 Input: nums = [1,1,1,2] and k = 3 Output:

  • [LintCode] 194. Find Words2022-06-12 08:32:48

    Given a string str and a dictionary dict, you need to find out which words in the dictionary are subsequences of the string and return those words.The order of the words returned should be the same as the order in the dictionary. |str|<=1000 the su

  • [LintCode] 438. Copy Books II2022-06-08 06:31:33

    Given n books and each book has the same number of pages. There are k persons to copy these books and the i-th person needs times[i] minutes to copy a book. Each person can copy any number of books and they start copying at the same time. What's the

  • 【LeetCode 31. 下一个排列】和 【LintCode 51. 上一个排列】2022-03-21 13:37:46

    31. 下一个排列 首先从后向前查找第一个顺序对 (i,i+1),满足 a[i] < a[i+1]。这样「较小数」即为 a[i]。此时 [i+1,n) 必然是下降序列。 如果找到了顺序对,那么在区间 [i+1,n) 中从后向前查找第一个元素 j 满足 a[i] < a[j]。这样「较大数」即为 a[j]。 交换 a[i] 与 a[j],此时可以

  • LintCode脸书面经真题+解析+代码:二叉树的所有路径2022-03-18 21:04:21

    描述 给一棵二叉树,找出从根节点到叶子节点的所有路径。 在线评测地址:LintCode 炼码Powerful coding training system. LintCode has the most interview problems covering Google, Facebook, Linkedin, Amazon, Microsoft and so on. We provide Chinese and English versions

  • LintCode 练习【C++】2022-03-03 13:02:20

    这里是LintCode【新手必刷编程50题】的解题思路 目录 1.反转一个三位整数 2.A+B问题  3.巴什博弈 4.计算圆的周长和面积  5.简单计算器   6.三数之中的最大值  7.大小写转换 8.判断数字与字母字符   9.月份天数 11.生成给定大小的数组 12.交换数组两个元素  13.整数排

  • LintCode苹果真题+解析+代码:勒索信2022-03-02 19:04:20

      描述 给定一个任意的表示勒索信内容的字符串,和另一个字符串表示杂志的内容,写一个方法判断能否通过剪下杂志中的内容来构造出这封勒索信,若可以,返回 true;否则返回 false。 杂志字符串中的每一个字符仅能在勒索信中使用一次。 你可以认为两个字符串都只包含小写字母。 在线评

  • LintCode python入门题2022-03-01 23:58:00

    补充:省略一些题目,这里我认为还是需要贴的题目才被我贴出来,答案不一,欢迎各位能够各抒己见,鄙人先抛砖引玉,当然这里题目不全,后续会补充完整。 目录 2940 · 字节串和字符串互转2931 · 从文件中读取字典并修改它2930 · 向文件里写入列表2929 · 找到最贵的商品(列表版)2927 ·

  • Leetcode 刷题必须Review 六 Lintcode(283 484 455 116 385)2022-02-21 17:03:21

    文章目录 283 · 三数之中的最大值484 · 交换数组两个元素455 · 学号116 · 跳跃游戏385 · 动态数组 283 · 三数之中的最大值 给三个整数,求他们中的最大值。 def maxOfThreeNumbers(self, num1, num2, num3): # write your code here max_val = flo

  • LintCode-165 · 合并两个排序链表-题解2022-02-20 18:02:39

    描述: 将两个排序(升序)链表合并为一个新的升序排序链表 样例 1: 输入: list1 = null, list2 = 0->3->3->null 输出: 0->3->3->null 样例2: 输入:  list1 =  1->3->8->11->15->null, list2 = 2->null 输出: 1->2->3->8->11->15->null 解题思路: 先对特殊情况进行判断,再创建一

  • LintCode-282 · 解压字符串-题解2022-02-20 18:00:35

    题目链接: https://www.lintcode.com/problem/282/description?_from=collection&fromId=208 描述: 小Q想要给他的朋友发送一个神秘字符串,但是他发现字符串太长了,于是小Q发明了一种压缩算法对字符串中重复的部分进行了压缩,对于字符串中连续的m个相同字符串S将会压缩为[m|S](m为一

  • 562 -背包问题IV - LintCode2022-02-07 19:01:27

    描述 给出 n 个物品, 以及一个数组, nums[i]代表第i个物品的大小, 保证大小均为正数并且没有重复, 正整数 target 表示背包的大小, 找到能填满背包的方案数。 每一个物品可以使用无数次 题目链接:https://www.lintcode.com/problem/562/ 方法1:递归 #include "iostream" #inclu

  • LintCode-165 · 合并两个排序链表-题解2022-01-28 13:00:59

    描述:将两个排序(升序)链表合并为一个新的升序排序链表样例 1:输入: list1 = null, list2 = 0->3->3->null输出: 0->3->3->null样例2:输入:  list1 =  1->3->8->11->15->null, list2 = 2->null输出: 1->2->3->8->11->15->null解题思路:先对特殊情况进行判断,再创建一个指针p用来接收

  • Lintcode题目打印X的思路分析2022-01-18 13:03:18

    打印X其实是一道找规律的题目,在开始分析这道题目的时候,陷入了一个误区,就是想按照输入的行数的奇偶来进行拆分(因为奇数总行数和偶数总行数最中心的哪个位置是不同的),然后还想按照上下各一半来处理,当上半部分处理完成后,再反转一下,最后拼接之后就好了,但是发现这种处理方式给自己带来了

  • LintCode练习:2854 · 自定义注解2022-01-12 19:31:31

    本题旨在练习自定义注解,无奈前面的知识点没有讲述自定义注解的详细信息,比如生命周期,作用对象等,所以导致这道题虽然提示了但是也不会的现状。 你还需要了解的自定义注解相关知识:(元注解) 本道题的参考答案: import java.lang.annotation.*; @Retention(RetentionPolicy.RUNTIME)

  • LintCode练习:2834 · 简单的字符串分割2022-01-06 18:33:59

    之前写其他代码的时候总觉得正则表达式又难又高级,其实。。。确实妙不可言(哈哈哈... 这道题其实还好啦,我觉得这个通过率是指第一次代码提交通过率。 我卡住的地方仅是正斜杠识别总是有问题。只需要注意匹配的时候不用*,用+即可,表示匹配至少1次,不然的话所有的字母都将拆分开。 原题:

  • LintCode练习:2832 · 简单校验一下邮箱格式2022-01-06 17:36:22

    他来了他来了,调了好几个Bug它终于通过了! 原题:    参考代码: 1 public class Solution { 2 public static boolean isMatch(String s) { 3 String regex = "^([A-Za-z]|_)([.\\w-]+)@([.\\w-]+)(.com)(|(.[\\w]+))$"; 4 return(s.matches(regex)); 5 }

  • LintCode 1984 · 统计不同教师 id 的数量(count 函数用法)2021-12-15 00:00:48

    LintCode 1984 · 统计不同教师 id 的数量(count 函数用法) 题目描述表定义: courses (课程表)样例解题思路使用 count 函数 题目地址:LintCode 1984 · 统计不同教师 id 的数量 题目描述 请编写 SQL 语句,统计课程表 courses 中不同的教师 id teacher_id 的数量,最后返回统

  • [lintcode] 151 · 买卖股票的蕞佳时机 III2021-11-28 15:00:51

      描述 假设你有一个数组,它的第i个元素是一支给定的股票在第i天的价格。设计一个算法来找到最大的利润。你最多可以完成两笔交易。 你不可以同时参与多笔交易(你必须在再次购买前出售掉之前的股票) 样例 样例 1 输入 : [4,4,6,1,1,4,2,5] 输出 : 6 思路: 这道题特别适合练习分

  • [LintCode] 397 · 最长上升连续子序列2021-11-25 16:58:00

    描述 给定一个整数数组(下标从 0 到 n-1, n 表示整个数组的规模),请找出该数组中的最长上升连续子序列。(最长上升连续子序列可以定义为从右到左或从左到右的序列。) 样例 样例 1: 输入:[5, 4, 2, 1, 3] 输出:4 解释: 给定 [5, 4, 2, 1, 3],其最长上升连续子序列(LICS)为 [5, 4, 2, 1],返回 4

  • 个人学习总结①2021-10-17 23:32:21

    1 计算机刷题网站集合 1.1 刷题建议 pat乙级 ——> pat甲级 ——> 《剑指offer》——> leetcode(简单、中等) 1.2 通用刷题网站 LintCode新手必刷50道 LeetCode 洛谷 牛客网 hihocoder(适合ACM) LintCode AcWing 1.2 Java刷题 边做边编程 以作业形式学习并巩固Jav

  • lintcode 5 · Kth Largest Element2021-10-15 23:57:58

    https://www.lintcode.com/problem/5/?_from=cat [] what is the bug? [code] public class Solution { /** * @param k: An integer * @param nums: An array * @return: the Kth largest element */ public int kthLargestElement(int k, int[

  • Lintcode 1872 · Minimum Cost to Connect Sticks [Python]2021-10-13 09:02:48

    题目在下方。读题目,有点儿费解,但是基本思路就是每次选择最小的棍子和第二小的棍子,加起来,丢回棍子堆里,然后继续重复,直到只剩下一个整的棍子。很容易想到用堆。 import heapq class Solution: """ @param sticks: the length of sticks @return: Minimum Cost to C

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有