自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(117)
  • 资源 (3)
  • 收藏
  • 关注

原创 C++-1DAY

基本内置类型char 和sign char 不一样sign char 可能是0-255 也可能是-127-128之间long 一般和int 一样大 如果超过int 使用long long建议算术表达不要用char 或者bool 只有在存放字符使用执行浮点运算选用double 是因为float通常精度不够而且双精度和单精度的计算代价无差.long double 消耗太大练习int long long long 和short 的区别?16 32 64 8位无符号类型和有符号类型的区别一个表

2022-04-01 18:11:43 1101

原创 小美的用户名

小美的用户名小美是美团的前端工程师,为了防止系统被恶意攻击,小美必须要在用户输入用户名之前做一个合法性检查,一个合法的用户名必须满足以下几个要求:用户名的首字符必须是大写或者小写字母。用户名只能包含大小写字母,数字。用户名需要包含至少一个字母和一个数字。如果用户名合法,请输出 “Accept”,反之输出 “Wrong”。格式:输入:输入第一行包含一个正整数 T,表示需要检验的用户名数量。接下来有 T 行,每行一个字符串 s,表示输入的用户名。输出:对于每一个输入的用户名 s,请输出一

2022-03-02 23:06:37 198

原创 剑指 Offer 28. 对称的二叉树

请实现一个函数,用来判断一棵二叉树是不是对称的。如果一棵二叉树和它的镜像一样,那么它是对称的。例如,二叉树 [1,2,2,3,4,4,3] 是对称的。1/ 2 2/ \ / 3 4 4 3但是下面这个 [1,2,2,null,3,null,3] 则不是镜像对称的:1/ 2 2\ 3 3class Solution {public: bool compare(TreeNode* left, TreeNode* right) { if

2022-03-01 21:39:02 93

原创 剑指 Offer 27. 二叉树的镜像

请完成一个函数,输入一个二叉树,该函数输出它的镜像。例如输入: 4/ 2 7/ \ / 1 3 6 9镜像输出: 4/ 7 2/ \ / 9 6 3 1示例 1:输入:root = [4,2,7,1,3,6,9]输出:[4,7,2,9,6,3,1]/** * Definition for a binary tree node. * struct TreeNode { * int val; * Tree

2022-03-01 21:11:43 250

原创 剑指 Offer 52. 两个链表的第一个公共节点

输入两个链表,找出它们的第一个公共节点。如下面的两个链表:在节点 c1 开始相交。示例 1:输入:intersectVal = 8, listA = [4,1,8,4,5], listB = [5,0,1,8,4,5], skipA = 2, skipB = 3输出:Reference of the node with value = 8输入解释:相交节点的值为 8 (注意,如果两个列表相交则不能为 0)。从各自的表头开始算起,链表 A 为 [4,1,8,4,5],链表 B 为 [5,0,1,8

2022-03-01 20:46:10 52

原创 剑指 Offer 25. 合并两个排序的链表

输入两个递增排序的链表,合并这两个链表并使新链表中的节点仍然是递增排序的。示例1:输入:1->2->4, 1->3->4输出:1->1->2->3->4->4限制:0 <= 链表长度 <= 1000class Solution {public: string convert(string s, int numRows) { int n = s.length(), r = numRows;

2022-03-01 17:24:59 238

原创 6.Z 字形变换

将一个给定字符串 s 根据给定的行数 numRows ,以从上往下、从左到右进行 Z 字形排列。比如输入字符串为 “PAYPALISHIRING” 行数为 3 时,排列如下:P A H NA P L S I I GY I R之后,你的输出需要从左往右逐行读取,产生出一个新的字符串,比如:“PAHNAPLSIIGYIR”。请你实现这个将字符串进行指定行数变换的函数:string convert(string s, int numRows);示例 1:输入:s = “PAY

2022-03-01 16:39:34 57

原创 剑指 Offer 18. 删除链表的节点

剑指 Offer 18. 删除链表的节点给定单向链表的头指针和一个要删除的节点的值,定义一个函数删除该节点。返回删除后的链表的头节点。注意:此题对比原题有改动示例 1:输入: head = [4,5,1,9], val = 5输出: [4,1,9]解释: 给定你链表中值为 5 的第二个节点,那么在调用了你的函数之后,该链表应变为 4 -> 1 -> 9.示例 2:输入: head = [4,5,1,9], val = 1输出: [4,5,9]解释: 给定你链表中值为 1 的

2022-02-28 14:44:31 46

原创 537. 复数乘法

复数 可以用字符串表示,遵循 “实部+虚部i” 的形式,并满足下述条件:实部 是一个整数,取值范围是 [-100, 100]虚部 也是一个整数,取值范围是 [-100, 100]i2 == -1给你两个字符串表示的复数 num1 和 num2 ,请你遵循复数表示形式,返回表示它们乘积的字符串。示例 1:输入:num1 = “1+1i”, num2 = “1+1i”输出:“0+2i”解释:(1 + i) * (1 + i) = 1 + i2 + 2 * i = 2i ,你需要将它转换为 0+2

2022-02-25 16:05:51 160

原创 剑指 Offer 10- II. 青蛙跳台阶问题

写一个函数,输入 n ,求斐波那契(Fibonacci)数列的第 n 项(即 F(N))。斐波那契数列的定义如下:F(0) = 0, F(1) = 1F(N) = F(N - 1) + F(N - 2), 其中 N > 1.斐波那契数列由 0 和 1 开始,之后的斐波那契数就是由之前的两数相加而得出。答案需要取模 1e9+7(1000000007),如计算初始结果为:1000000008,请返回 1。示例 1:输入:n = 2输出:1示例 2:输入:n = 5输出:5提示:

2022-02-25 12:04:34 120

原创 剑指 Offer 10- I. 斐波那契数列

写一个函数,输入 n ,求斐波那契(Fibonacci)数列的第 n 项(即 F(N))。斐波那契数列的定义如下:F(0) = 0, F(1) = 1F(N) = F(N - 1) + F(N - 2), 其中 N > 1.斐波那契数列由 0 和 1 开始,之后的斐波那契数就是由之前的两数相加而得出。答案需要取模 1e9+7(1000000007),如计算初始结果为:1000000008,请返回 1。示例 1:输入:n = 2输出:1示例 2:输入:n = 5输出:5clas

2022-02-25 11:40:01 50

原创 【无标题】

产品经理(PM)有很多好的idea,而这些idea需要程序员实现。现在有N个PM,在某个时间会想出一个 idea,每个 idea 有提出时间、所需时间和优先等级。对于一个PM来说,最想实现的idea首先考虑优先等级高的,相同的情况下优先所需时间最小的,还相同的情况下选择最早想出的,没有 PM 会在同一时刻提出两个 idea。同时有M个程序员,每个程序员空闲的时候就会查看每个PM尚未执行并且最想完成的一个idea,然后从中挑选出所需时间最小的一个idea独立实现,如果所需时间相同则选择PM序号最小的。直到完

2022-02-25 11:24:18 51

原创 【无标题】

给定一个数组序列, 需要求选出一个区间, 使得该区间是所有区间中经过如下计算的值最大的一个:区间中的最小数 * 区间所有数的和最后程序输出经过计算后的最大值即可,不需要输出具体的区间。如给定序列 [6 2 1]则根据上述公式, 可得到所有可以选定各个区间的计算值:[6] = 6 * 6 = 36;[2] = 2 * 2 = 4;[1] = 1 * 1 = 1;[6,2] = 2 * 8 = 16;[2,1] = 1 * 3 = 3;[6, 2, 1] = 1 * 9 = 9;从上述计算可见

2022-02-24 23:00:23 58

原创 【无标题】

1/5[编程题]编程题1时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 32M,其他语言64MP为给定的二维平面整数点集。定义 P 中某点x,如果x满足 P 中任意点都不在 x 的右上方区域内(横纵坐标都大于x),则称其为“最大的”。求出所有“最大的”点的集合。(所有点的横坐标和纵坐标都不重复, 坐标轴范围在[0, 1e9) 内)如下图:实心点为满足条件的点的集合。请实现代码找到集合 P 中的所有 ”最大“ 点的集合并输出。输入描述:第一行输入点集的个数 N, 接下来 N 行,每

2022-02-24 21:51:20 51

原创 Leecode 172

阶乘后的零给定一个整数 n ,返回 n! 结果中尾随零的数量。提示 n! = n * (n - 1) * (n - 2) * … * 3 * 2 * 1示例 1:输入:n = 3输出:0解释:3! = 6 ,不含尾随 0示例 2:输入:n = 5输出:1解释:5! = 120 ,有一个尾随 0示例 3:输入:n = 0输出:0提示:0 <= n <= 104进阶:你可以设计并实现对数时间复杂度的算法来解决此问题吗?相关标签数学作者:字节校园链接:htt.

2022-02-24 15:01:42 50

原创 1. 两数之和

1. 两数之和难度简单11417给定一个整数数组nums和一个整数目标值target,请你在该数组中找出和为目标值target 的那两个整数,并返回它们的数组下标。你可以假设每种输入只会对应一个答案。但是,数组中同一个元素在答案里不能重复出现。你可以按任意顺序返回答案。示例 1:输入:nums = [2,7,11,15], target = 9输出:[0,1]解释:因为 nums[0] + nums[1] == 9 ,返回 [0, 1] 。示例 2:...

2021-06-25 22:04:32 110

转载 1052 Linked List Sorting (25 分)

1052 Linked List Sorting (25 分)A linked list consists of a series of structures, which are not necessarily adjacent in memory. We assume that each structure contains an integerkeyand aNextpointer to the next structure. Now given a linked list, you...

2021-05-16 09:59:27 56

原创 1032 Sharing (25 分)

1032 Sharing (25 分)To store English words, one method is to use linked lists and store a word letter by letter. To save some space, we may let the words share the same sublist if they share the same suffix. For example,loadingandbeingare stored as sh...

2021-05-16 00:33:26 75

原创 1133 Splitting A Linked List (25 分)

Given a singly linked list, you are supposed to rearrange its elements so that all the negative values appear before all of the non-negatives, and all the values in [0, K] appear before all those greater than K. The order of the elements inside each class

2021-05-16 00:32:00 65

原创 1062 Talent and Virtue (25分)

1062Talent and Virtue(25分)About 900 years ago, a Chinese philosopher Sima Guang wrote a history book in which he talked about people's talent and virtue. According to his theory, a man being outstanding in both talent and virtue must be a "sage(圣人)"; b..

2021-01-23 00:13:24 85

原创 188. Best Time to Buy and Sell Stock IV

You are givenan integer array prices where prices[i]is the price of a given stock on the ith day.Design an algorithm to find the maximum profit. You may complete at most k transactions.Notice that you may not engage in multiple transactions simultane..

2020-11-13 23:28:16 101

原创 123. Best Time to Buy and Sell Stock III

Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complete at mosttwotransactions.Note:You may not engage in multiple transactions at the same time (i.e., y...

2020-11-13 22:31:53 84

原创 309. Best Time to Buy and Sell Stock with Cooldown

Your are given an array of integers prices, for which the i-th element is the price of a given stock on day i; and a non-negative integer fee representing a transaction fee.You may complete as many transactions as you like, but you need to pay the transa

2020-11-13 12:38:02 54

原创 122. Best Time to Buy and Sell Stock II

Say you have an array prices for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete as many transactions as you like (i.e., buy one and sell one share of the stock multiple times)

2020-11-13 11:24:40 50

原创 121. Best Time to Buy and Sell Stock

题目描述121. Best Time to Buy and Sell Stock难度简单1295Say you have an array for which theithelement is the price of a given stock on dayi.If you were only permitted to complete at most one transaction (i.e., buy one and sell one share of the stock), d...

2020-11-13 10:44:28 54

原创 52. N-Queens II

难度困难205Then-queens puzzle is the problem of placingnqueens on ann×nchessboard such that no two queens attack each other.Given an integern, return the number ofdistinct solutions to then-queens puzzle.Example:Input: 4Output: 2Explanatio...

2020-11-02 22:51:43 59

原创 Leetcode 213House Robber II

213. House Robber II难度中等406You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed. All houses at this place arearranged in a circle.That means the first house is the neighbor of the last ..

2020-11-01 18:15:37 75

原创 Leetcode 198. House Robber

You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed. All houses at this place are arranged in a circle. That means the first house is the neighbor of the last one. Meanwhile, adjacent houses

2020-11-01 17:40:32 71

原创 1077 Kuchiguse (20分)

1077Kuchiguse(20分)The Japanese language is notorious for its sentence ending particles. Personal preference of such particles can be considered as a reflection of the speaker's personality. Such a preference is called "Kuchiguse" and is often exaggerat..

2020-10-24 22:01:24 106

原创 1035 Password (20分)

To prepare for PAT, the judge sometimes has to generate random passwords for the users. The problem is that there are always some confusing passwords since it is hard to distinguish1(one) froml(Lin lowercase), or0(zero) fromO(oin uppercase). One ...

2020-10-24 19:10:55 82

原创 1048 数字加密 (20分)

本题要求实现一种数字加密方法。首先固定一个加密用正整数 A,对任一正整数 B,将其每 1 位数字与 A 的对应位置上的数字进行以下运算:对奇数位,对应位的数字相加后对 13 取余——这里用 J 代表 10、Q 代表 11、K 代表 12;对偶数位,用 B 的数字减去 A 的数字,若结果为负数,则再加 10。这里令个位为第 1 位。输入格式:输入在一行中依次给出 A 和 B,均为不超过 100 位的正整数,其间以空格分隔。输出格式:在一行中输出加密后的结果。输入样例:1234567

2020-10-23 18:06:21 231

原创 1073 Scientific Notation (20分)

Scientific notation is the way that scientists easily handle very large numbers or very small numbers. The notation matches the regular expression [+-][1-9].[0-9]+E[+-][0-9]+ which means that the integer portion has exactly one digit, there is at least one

2020-10-23 11:44:12 89

原创 1061 Dating (20分)

Sherlock Holmes received a note with some strange strings:Let's date! 3485djDkxh4hhGE 2984akDfkkkkggEdsb s&hgsfdk d&Hyscvnm. It took him only a minute to figure out that those strange strings are actually referring to the coded timeThursday 14:04..

2020-10-23 02:38:48 101

原创 1009 说反话 (20分)

给定一句英语,要求你编写程序,将句中所有单词的顺序颠倒输出。输入格式:测试输入包含一个测试用例,在一行内给出总长度不超过 80 的字符串。字符串由若干单词和若干空格组成,其中单词是由英文字母(大小写有区分)组成的字符串,单词之间用 1 个空格分开,输入保证句子末尾没有多余的空格。输出格式:每个测试用例的输出占一行,输出倒序后的句子。输入样例:Hello World Here I Come输出样例:Come I Here World Hello#include...

2020-10-23 01:25:25 100

原创 1021 个位数统计 (15分)

给定一个k位整数N=d​k−1​​10​k−1​​+⋯+d​1​​10​1​​+d​0​​(0≤d​i​​≤9,i=0,⋯,k−1,d​k−1​​>0),请编写程序统计每种不同的个位数字出现的次数。例如:给定N=100311,则有 2 个 0,3 个 1,和 1 个 3。输入格式:每个输入包含 1 个测试用例,即一个不超过 1000 位的正整数N。输出格式:对N中每一种不同的个位数字,以D:M的格式在一行中输出该位数字D及其在N中出现的次数M。要求按...

2020-10-23 01:13:35 193 1

原创 1058 A+B in Hogwarts (20分)

If you are a fan of Harry Potter, you would know the world of magic has its own currency system -- as Hagrid explained it to Harry, "Seventeen silver Sickles to a Galleon and twenty-nine Knuts to a Sickle, it's easy enough." Your job is to write a progr...

2020-10-23 00:35:17 704 1

原创 1027 Colors in Mars (20分)

1027Colors in Mars(20分)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 forRed, the middle 2 digits forGreen, and the last 2...

2020-10-23 00:12:32 108

原创 1019 General Palindromic Number (20分)

1019General Palindromic Number(20分)A number that will be the same when it is written forwards or backwards is known as aPalindromic Number. For example, 1234321 is a palindromic number. All single digit numbers are palindromic numbers.Although palin...

2020-10-22 02:39:35 47

原创 1031 Hello World for U (20分)

1031Hello World for U(20分)Given any string ofN(≥5) characters, you are asked to form the characters into the shape ofU. For example,helloworldcan be printed as:h de ll rlowoThat is, the characters must be printed in the original order,...

2020-10-22 01:33:17 50

原创 2020-10-21

1036 Boys vs Girls (25分)This time you are asked to tell the difference between the lowest grade of all the male students and the highest grade of all the female students.Input Specification:Each input file contains one test case. Each case contains a po

2020-10-21 01:56:23 80

19考研数学基础班001高等数学汤家凤加密.mp4

学习看他

2020-11-09

第一章-算法概述-1.pdf

第一章-算法概述-1.pdf

2020-07-23

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除