
leetcode
ClassRoom706
这个作者很懒,什么都没留下…
展开
-
字符逆序
题目描述将一个字符串str的内容颠倒过来,并输出。str的长度不超过100个字符。 如:输入“I am a student”,输出“tneduts a ma I”。输入参数:inputString:输入的字符串返回值:输出转换好的逆序字符串输入描述:输入一个字符串,可以有空格输出描述:输出逆序的字符串示例1输入I am a student输出tneduts a ma Icode直接调用了c++的标准算法reverse。#include<string>#incl原创 2020-07-27 11:44:21 · 386 阅读 · 0 评论 -
求立方根
题目描述•计算一个数字的立方根,不使用库函数详细描述:输入:double 待求解参数返回值:double 输入参数的立方根,保留一位小数输入描述:待求解参数 double类型输出描述:输入参数的立方根 也是double类型示例1输入216输出6.0code利用牛顿迭代公式:#include<iostream>#include<cmath>using namespace std;static double subFuc(double gues原创 2020-07-27 10:27:33 · 496 阅读 · 0 评论 -
求最小公倍数
求最小公倍数题目描述正整数A和正整数B 的最小公倍数是指 能被A和B整除的最小的正整数值,设计一个算法,求输入A和B的最小公倍数。输入描述:输入两个正整数A和B。输出描述:输出A和B的最小公倍数。示例1输入5 7输出35code#include<iostream>using namespace std;int Func_Yue(int a, int b){ if(a<b) { int tmp=a; a=b原创 2020-07-27 08:39:47 · 200 阅读 · 0 评论 -
Two Sum
1 Two Sumclass Solution {public: vector<int> twoSum(vector<int>& nums, int target) { vector<int> result; unordered_map<int, int> hash; for(int...原创 2019-01-08 16:40:20 · 169 阅读 · 0 评论 -
Add Two Numbers
Add Two Numbersclass Solution {public: ListNode* addTwoNumbers(ListNode* l1, ListNode* l2) { ListNode preHead(0), *p = &preHead; int extra = 0; while (l1 || l2 || extra) { ...转载 2019-01-08 16:43:58 · 247 阅读 · 0 评论 -
3. Longest Substring Without Repeating Characters
Longest Substring Without Repeating Charactersclass Solution {public: int lengthOfLongestSubstring(string s) { vector<int> dictionary(256,-1); int maxLen=0,init=-1; ...原创 2019-01-08 17:43:21 · 176 阅读 · 0 评论 -
Wiggle Subsequence & IPO
Wiggle Subsequence题目解答题目376 Wiggle SubsequenceMediumA sequence of numbers is called a wiggle sequence if the differences between successive numbers strictly alternate between positive and negative...原创 2019-08-25 23:39:46 · 232 阅读 · 0 评论 -
Two Sum and Best Time to Buy and Sell Stock II
Problem1 Two Sum题目1. Two Sumanswer分析题目122. Best Time to Buy and Sell Stock IIanswer题目1. Two SumEasyGiven an array of integers, return indices of the two numbers such that they add up to a specif...原创 2019-08-18 12:39:57 · 156 阅读 · 0 评论