
OJ随笔
xiaobo_z
这个作者很懒,什么都没留下…
展开
-
[编程题]vivo智能手机产能
来源:牛客vivo2020届春季校园招聘在线编程考试在vivo产线上,每位职工随着对手机加工流程认识的熟悉和经验的增加,日产量也会不断攀升。假设第一天量产1台,接下来2天(即第二、三天)每天量产2件,接下来3天(即第四、五、六天)每天量产3件 … …以此类推,请编程计算出第n天总共可以量产的手机数量。思路day保存天数,rtn保存总计的手机数量,perday保存每天产能,temp保存该产...原创 2020-04-03 21:23:09 · 1053 阅读 · 0 评论 -
[编程题]数位之积
来源:牛客vivo2020届春季校园招聘在线编程考试现给定任意正整数 n,请寻找并输出最小的正整数 m(m>9),使得 m 的各位(个位、十位、百位 … …)之乘积等于n,若不存在则输出 -1。思路:大数放后,小数放前,不断取余。import java.util.*;public class Solution { /** * 输入一个整形数值,返回一个整形值 ...原创 2020-04-03 21:08:39 · 1877 阅读 · 0 评论 -
[编程题]手机屏幕解锁模式
来源:牛客vivo2020届春季校园招聘在线编程考试现有一个 3x3 规格的 Android 智能手机锁屏程序和两个正整数 m 和 n ,请计算出使用最少m 个键和最多 n个键可以解锁该屏幕的所有有效模式总数。其中有效模式是指:1、每个模式必须连接至少m个键和最多n个键;2、所有的键都必须是不同的;3、如果在模式中连接两个连续键的行通过任何其他键,则其他键必须在模式中选择,不允许跳过非选...原创 2020-04-03 20:45:46 · 1718 阅读 · 0 评论 -
leetcode Best Time to Buy and Sell Stock专题
最佳时间买卖股票问题在leetcode中出现了很多次,并且这些题目之间也具有相似性,所以我将它们做成一个专题来进行总结。121. Best Time to Buy and Sell Stock题目:Say you have an array for which the ithi^thith element is the price of a given stock on day iii.I...原创 2020-03-01 12:50:54 · 175 阅读 · 0 评论 -
Leetcode639. Decode Ways II
题目:A message containing letters from A-Z is being encoded to numbers using the following mapping way:'A' -> 1'B' -> 2...'Z' -> 26Beyond that, now the encoded string can also contain th...原创 2020-02-27 14:36:13 · 175 阅读 · 0 评论 -
Leetcode91. Decode Ways
题目:A message containing letters from A-Z is being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given a non-empty string containing only digits, determine ...原创 2020-02-27 10:19:39 · 167 阅读 · 0 评论 -
Leetcode44. Wildcard Matching
题目:Given an input string (s) and a pattern (p), implement wildcard pattern matching with support for '?' and '*'.'?' Matches any single character.'*' Matches any sequence of characters (including t...原创 2020-02-23 10:10:03 · 176 阅读 · 0 评论 -
Leetcode10. Regular Expression Matching
题目:Given an input string (s) and a pattern (p), implement regular expression matching with support for '.' and '*'.'.' Matches any single character.'*' Matches zero or more of the preceding element...原创 2020-02-21 14:14:13 · 242 阅读 · 0 评论 -
leetcode 39. Combination Sum(回溯算法)
题目内容给定一组候选数字(没有重复)和一个目标数字,找出候选数字之和与目标数字相等的所有唯一组合。同一候选数字可以重复出现多次。注意:所有数字都是正整数解集不能包含重复组合分析...原创 2019-09-03 19:42:25 · 140 阅读 · 0 评论 -
42. Trapping Rain Water 暴力解法
class Solution {public: int trap_recursion(vector<int> height, int left, int right){ if(left == right) return 0; int max_left = left, pos_left = left; int max_right ...原创 2019-08-18 18:14:52 · 169 阅读 · 0 评论