随笔分类 -  算法学习打卡

上一页 1 ··· 5 6 7 8 9 10 下一页
摘要:地址:https://leetcode-cn.com/problems/compress-string-lcci/ <?php /** 字符串压缩。利用字符重复出现的次数,编写一种方法,实现基本的字符串压缩功能。比如,字符串aabcccccaaa会变为a2b1c5a3。若“压缩”后的字符串没有变短, 阅读全文
posted @ 2020-03-31 09:45 花花妹子。 阅读(133) 评论(0) 推荐(0)
摘要:d地址:https://leetcode-cn.com/problems/maximum-69-number/ <?php /** 给你一个仅由数字 6 和 9 组成的正整数 num。 你最多只能翻转一位数字,将 6 变成 9,或者把 9 变成 6 。 请返回你可以得到的最大数字。 示例 1: 输入 阅读全文
posted @ 2020-03-30 17:35 花花妹子。 阅读(213) 评论(0) 推荐(0)
摘要:地址:https://leetcode-cn.com/problems/jewels-and-stones/ <?php /** 给定字符串J 代表石头中宝石的类型,和字符串 S代表你拥有的石头。 S 中每个字符代表了一种你拥有的石头的类型,你想知道你拥有的石头中有多少是宝石。 J 中的字母不重复, 阅读全文
posted @ 2020-03-29 23:07 花花妹子。 阅读(122) 评论(0) 推荐(0)
摘要:地址:https://leetcode-cn.com/problems/decompress-run-length-encoded-list/ <?php /** 给你一个以行程长度编码压缩的整数列表 nums 。 考虑每对相邻的两个元素 freq, val] = [nums[2*i], nums[ 阅读全文
posted @ 2020-03-28 20:02 花花妹子。 阅读(159) 评论(0) 推荐(0)
摘要:地址:https://leetcode-cn.com/problems/create-target-array-in-the-given-order/ <?php /** 给你两个整数数组 nums 和 index。你需要按照以下规则创建目标数组: 目标数组 target 最初为空。 按从左到右的顺 阅读全文
posted @ 2020-03-28 19:48 花花妹子。 阅读(145) 评论(0) 推荐(0)
摘要:地址:https://leetcode-cn.com/problems/find-numbers-with-even-number-of-digits/ <?php /** 给你一个整数数组 nums,请你返回其中位数为 偶数 的数字的个数。 示例 1: 输入:nums = [12,345,2,6, 阅读全文
posted @ 2020-03-28 13:10 花花妹子。 阅读(242) 评论(0) 推荐(0)
摘要:地址:https://leetcode-cn.com/problems/qiu-12n-lcof/ <?php /** 求 1+2+...+n ,要求不能使用乘除法、for、while、if、else、switch、case等关键字及条件判断语句(A?B:C)。 示例 1: 输入: n = 3 输出 阅读全文
posted @ 2020-03-28 10:08 花花妹子。 阅读(112) 评论(0) 推荐(0)
摘要:d地址:https://leetcode-cn.com/problems/x-of-a-kind-in-a-deck-of-cards/ <?php /** 给定一副牌,每张牌上都写着一个整数。 此时,你需要选定一个数字 X,使我们可以将整副牌按下述规则分成 1 组或更多组: 每组都有 X 张牌。 阅读全文
posted @ 2020-03-28 09:52 花花妹子。 阅读(146) 评论(0) 推荐(0)
摘要:di地址:https://leetcode-cn.com/problems/subtract-the-product-and-sum-of-digits-of-an-integer/ <?php /** 给你一个整数 n,请你帮忙计算并返回该整数「各位数字之积」与「各位数字之和」的差。 示例 1: 阅读全文
posted @ 2020-03-27 11:58 花花妹子。 阅读(248) 评论(0) 推荐(0)
摘要:地址:https://leetcode-cn.com/problems/guess-numbers/ <?php /** 小A 和 小B 在玩猜数字。小B 每次从 1, 2, 3 中随机选择一个,小A 每次也从 1, 2, 3 中选择一个猜。他们一共进行三次这个游戏,请返回 小A 猜对了几次? 输入 阅读全文
posted @ 2020-03-27 11:44 花花妹子。 阅读(177) 评论(0) 推荐(0)
摘要:d地址:https://leetcode-cn.com/problems/remove-duplicates-from-sorted-array/ <?php /** 给定一个排序数组,你需要在 原地 删除重复出现的元素,使得每个元素只出现一次,返回移除后数组的新长度。 不要使用额外的数组空间,你必 阅读全文
posted @ 2020-03-27 11:13 花花妹子。 阅读(137) 评论(0) 推荐(0)
摘要:地址:https://leetcode-cn.com/problems/intersection-of-two-arrays/ <?php /** 给定两个数组,编写一个函数来计算它们的交集。 示例 1: 输入: nums1 = [1,2,2,1], nums2 = [2,2] 输出: [2] 示例 阅读全文
posted @ 2020-03-27 10:19 花花妹子。 阅读(124) 评论(0) 推荐(0)
摘要:地址:https://leetcode-cn.com/problems/how-many-numbers-are-smaller-than-the-current-number/ <?php /** 给你一个数组 nums,对于其中每个元素 nums[i],请你统计数组中比它小的所有数字的数目。 换 阅读全文
posted @ 2020-03-27 09:41 花花妹子。 阅读(224) 评论(0) 推荐(0)
摘要:地址:https://leetcode-cn.com/problems/reformat-department-table/ ## 编写一个 SQL 查询来重新格式化表,使得新的表中有一个部门 id 列和一些对应 每个月 的收入(revenue)列。 示例: 部门表 Department: + + 阅读全文
posted @ 2020-03-26 17:15 花花妹子。 阅读(238) 评论(0) 推荐(0)
摘要:地址:https://leetcode-cn.com/problems/customers-who-never-order/ ## 某网站包含两个表,Customers 表和 Orders 表。编写一个 SQL 查询,找出所有从不订购任何东西的客户。 示例: Customers 表: + + + | 阅读全文
posted @ 2020-03-26 16:55 花花妹子。 阅读(115) 评论(0) 推荐(0)
摘要:地址:https://leetcode-cn.com/problems/palindrome-number/ <?php /** 判断一个整数是否是回文数。回文数是指正序(从左向右)和倒序(从右向左)读都是一样的整数。 示例 1: 输入: 121 输出: true 示例 2: 输入: -121 输出 阅读全文
posted @ 2020-03-26 15:36 花花妹子。 阅读(211) 评论(0) 推荐(0)
摘要:地址:https://leetcode-cn.com/problems/binary-search/ <?php /** 给定一个 n 个元素有序的(升序)整型数组 nums 和一个目标值 target ,写一个函数搜索 nums 中的 target,如果目标值存在返回下标,否则返回 -1。 示例 阅读全文
posted @ 2020-03-26 14:38 花花妹子。 阅读(113) 评论(0) 推荐(0)
摘要:地址:https://leetcode-cn.com/problems/length-of-last-word/ <?php /** 给定一个仅包含大小写字母和空格 ' ' 的字符串 s,返回其最后一个单词的长度。如果字符串从左向右滚动显示,那么最后一个单词就是最后出现的单词。 如果不存在最后一个单 阅读全文
posted @ 2020-03-25 14:38 花花妹子。 阅读(102) 评论(0) 推荐(0)
摘要:地址:https://leetcode-cn.com/problems/search-insert-position/ <?php /** 给定一个排序数组和一个目标值,在数组中找到目标值,并返回其索引。如果目标值不存在于数组中,返回它将会被按顺序插入的位置。 你可以假设数组中无重复元素。 示例 1 阅读全文
posted @ 2020-03-25 11:41 花花妹子。 阅读(231) 评论(0) 推荐(0)
摘要:地址:https://leetcode-cn.com/problems/reverse-string/ <?php /** 编写一个函数,其作用是将输入的字符串反转过来。输入字符串以字符数组 char[] 的形式给出。 不要给另外的数组分配额外的空间,你必须原地修改输入数组、使用 O(1) 的额外空 阅读全文
posted @ 2020-03-24 14:05 花花妹子。 阅读(158) 评论(0) 推荐(0)

上一页 1 ··· 5 6 7 8 9 10 下一页