ICode9

精准搜索请尝试: 精确搜索
  • PAT Advanced 1027 Colors in Mars(20)2022-08-21 00:31:45

    题目描述: People in Mars represent the colors in their computers in a similar way as the Earth people. That is, a color is represented by a 6-digit number, where the first 2 digits are for Red, the middle 2 digits for Green, and the last 2 digits for Blue. Th

  • 数位DP-902. 最大为 N 的数字组合2022-08-14 22:32:34

    问题描述 给定一个按 非递减顺序 排列的数字数组 digits 。你可以用任意次数 digits[i] 来写的数字。例如,如果 digits = ['1','3','5'],我们可以写数字,如 '13', '551', 和 '1351315'。 返回 可以生成的小于或等于给定整数 n 的正整数的个数 。 示例 1: 输入:digits = ["1

  • 加一2022-08-14 15:02:42

    给定一个由 整数 组成的 非空 数组所表示的非负整数,在该数的基础上加一。最高位数字存放在数组的首位, 数组中每个元素只存储单个数字。你可以假设除了整数 0 之外,这个整数不会以零开头。 示例 1:输入:digits = [1,2,3]输出:[1,2,4]解释:输入数组表示数字 123。示例 2:输入:digits = [4,3

  • LeetCode 2094. Finding 3-Digit Even Numbers2022-08-08 03:00:27

    原题链接在这里:https://leetcode.com/problems/finding-3-digit-even-numbers/ 题目: You are given an integer array digits, where each element is a digit. The array may contain duplicates. You need to find all the unique integers that follow the given requirem

  • 17. 电话号码的字母组合2022-08-03 23:35:40

    17. 电话号码的字母组合 给定一个仅包含数字 2-9 的字符串,返回所有它能表示的字母组合。答案可以按 任意顺序 返回。 给出数字到字母的映射如下(与电话按键相同)。注意 1 不对应任何字母。         示例 1: 输入:digits = "23" 输出:["ad","ae","af","bd","be","bf","cd",&qu

  • leetcode.66. 加一2022-07-30 00:04:57

    给定一个由 整数 组成的 非空 数组所表示的非负整数,在该数的基础上加一。 最高位数字存放在数组的首位, 数组中每个元素只存储单个数字。 你可以假设除了整数 0 之外,这个整数不会以零开头。   示例 1: 输入:digits = [1,2,3]输出:[1,2,4]解释:输入数组表示数字 123。示例 2: 输入:di

  • 加12022-07-22 14:10:31

    介绍:将一个数组看成数字,在末位加1;返回一个数组 eg:[1,2,3] --> 123 +1 = 124 ---> [1,2,4] eg:[9,9] --> 99 + 1 = 100 ---> [1,0,0] public class PlusOne { public static void main(String[] args) { int[] ints = {3, 4, 5, 3, 2, 4, 5, 8, 9}; Solution

  • LeetCode 738. Monotone Increasing Digits2022-06-28 17:33:55

    LeetCode 738. Monotone Increasing Digits (单调递增的数字) 题目 链接 https://leetcode.cn/problems/monotone-increasing-digits/ 问题描述 当且仅当每个相邻位数上的数字 x 和 y 满足 x <= y 时,我们称这个整数是单调递增的。 给定一个整数 n ,返回 小于或等于 n 的最大

  • 力扣算法JS LC [17. 电话号码的字母组合] LC [93. 复原 IP 地址]2022-06-19 23:38:06

    ​ LC 17. 电话号码的字母组合 给定一个仅包含数字 2-9 的字符串,返回所有它能表示的字母组合。答案可以按 任意顺序 返回。 给出数字到字母的映射如下(与电话按键相同)。注意 1 不对应任何字母。 ​ 编辑 示例 1: 输入:digits = "23" 输出:["ad","ae","af","bd","be","bf","cd",&quo

  • LeetCode 17. Letter Combinations of a Phone Number2022-06-13 22:37:07

    LeetCode 17. Letter Combinations of a Phone Number (电话号码的字母组合) 题目 链接 https://leetcode.cn/problems/letter-combinations-of-a-phone-number/ 问题描述 给定一个仅包含数字 2-9 的字符串,返回所有它能表示的字母组合。答案可以按 任意顺序 返回。 给出数字到字

  • 力扣66(java)-加一(简单)2022-06-12 10:00:21

    题目: 给定一个由 整数 组成的 非空 数组所表示的非负整数,在该数的基础上加一。 最高位数字存放在数组的首位, 数组中每个元素只存储单个数字。 你可以假设除了整数 0 之外,这个整数不会以零开头。  示例 1: 输入:digits = [1,2,3]输出:[1,2,4]解释:输入数组表示数字 123。示例 2: 输

  • Leetcode 2094. 找出 3 位偶数2022-06-05 11:31:36

    给你一个整数数组 digits ,其中每个元素是一个数字(0 - 9)。数组中可能存在重复元素。 你需要找出 所有 满足下述条件且 互不相同 的整数: 该整数由 digits 中的三个元素按 任意 顺序 依次连接 组成。 该整数不含 前导 零 该整数是一个 偶数 例如,给定的 digits 是 [1, 2, 3] ,

  • 066.加一2022-06-03 15:04:55

    给定一个由 整数 组成的 非空 数组所表示的非负整数,在该数的基础上加一。 最高位数字存放在数组的首位, 数组中每个元素只存储单个数字。 你可以假设除了整数 0 之外,这个整数不会以零开头。   示例 1: 输入:digits = [1,2,3]输出:[1,2,4]解释:输入数组表示数字 123。示例 2: 输入:dig

  • 1027 Colors in Mars(20分)2022-06-02 17:32:54

    People in Mars represent the colors in their computers in a similar way as the Earth people. That is, a color is represented by a 6-digit number, where the first 2 digits are for Red, the middle 2 digits for Green, and the last 2 digits for Blue. The only

  • AtCoder Regular Contest 141 - B - Increasing Prefix XOR2022-05-30 18:36:11

    原文 Consider the problem in binary. If positive integers \(a\) and \(b\) have the same number of digits, the only case when both \(a<c\) and \(b < b\oplus c\) hold is when \(c\) has more digits than each of \(a\) and \(b\), in which ca

  • 1281. Subtract the Product and Sum of Digits of an Integer2022-05-18 01:02:55

    !!!题目地址!!! int subtractProductAndSum(int n){ int product = 1; int sum = 0; while(n != 0){ product *= n%10; sum += n%10; n /= 10; } return product-sum; }

  • leetcode回溯问题2022-05-13 14:33:58

    回溯法也可以叫做回溯搜索法,它是一种搜索的方式。 回溯是递归的副产品,只要有递归就会有回溯。所以回溯函数也就是递归函数,指的都是一个函数 因为回溯的本质是穷举,穷举所有可能,然后选出我们想要的答案,如果想让回溯法高效一些,可以加一些剪枝的操作,但也改不了回溯法就是穷举的本质。

  • 力扣简66 +12022-05-11 13:02:49

    还是暴力写法 转成数加一再压回 下面有错误 对于超过int类型的整数出错 还没有改好   class Solution {     public int[] plusOne(int[] digits) {         int sum=0;         int count=0;         int flag=0;         int 

  • Leetcode 17. 电话号码的字母组合2022-05-09 23:00:37

    17. 电话号码的字母组合 - 力扣(LeetCode)     思路 回溯法   func letterCombinations(digits string) []string { if len(digits) == 0 || len(digits) > 4 { return nil } strMap := [10]string{ "", "", "abc", "def", &quo

  • LeetCode每日一练【17】2022-05-02 19:03:53

    Letter Combinations of a Phone Number 我的解法 第一次提交 介绍 虽然没有什么期待, 但是貌似结果出乎意料的好, 使用三重循环遍历的方式解决问题 思路 其实没啥好说的, 就一层一层嵌套循环遍历呗 代码 /* * @Author: fox * @Date: 2022-05-02 17:04:48 * @LastEditors: fo

  • [LeetCode] 1295. Find Numbers with Even Number of Digits 统计位数为偶数的数字2022-04-24 01:31:05

    Given an array nums of integers, return how many of them contain an even number of digits. Example 1: Input: nums = [12,345,2,6,7896] Output: 2 Explanation: 12 contains 2 digits (even number of digits).  345 contains 3 digits (odd number of digits).  2

  • 17 电话号码的字母组合(LeetCode HOT 100)2022-04-09 12:00:07

    描述: 给定一个仅包含数字 2-9 的字符串,返回所有它能表示的字母组合。答案可以按 任意顺序 返回。 给出数字到字母的映射如下(与电话按键相同)。注意 1 不对应任何字母。 示例 1: 输入:digits = "23" 输出:["ad","ae","af","bd","be","bf","cd","ce","cf&

  • LeetCode 0066 Plus One2022-04-09 06:31:38

    原题传送门 1. 题目描述 2. Solution 1 1、思路分析 从右往左遍历digits,若digits[i] 小于9,则直接对digits[i] 进行自增,并返回结果;若digits[i]等于9,则将digits[i]置为0,处理下一位。 若循环结束尚未返回结果,说明digits里面的数字全部是9,上面的操作已经把所有的9置为0,需要新开数组长

  • [LeetCode] 1291. Sequential Digits 顺次数2022-04-04 23:35:48

    An integer has sequential digits if and only if each digit in the number is one more than the previous digit. Return a sorted list of all the integers in the range [low, high] inclusive that have sequential digits. Example 1: Input: low = 100, high =

  • 66. Plus One2022-03-31 04:31:12

    My first solution: class Solution { public int[] plusOne(int[] digits) { int n = digits.length; int carry = 1; for(int i=n-1;i>=0;i--){ int digit = digits[i]; int sum = digit+carry; if(su

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

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

ICode9版权所有