码迷,mamicode.com
首页 >  
搜索关键字:turn    ( 27138个结果
二分图
二分图 1. 概念 二分图 :把一个图的顶点划分为两个不相交集 和 ,使得每一条边都分别连接 、`V 1` 是一个二分图。为了清晰,我们以后都把它画成图 的形式。 匹配 :在图论中,一个「匹配」( )是一个 边 的 集合 ,其中 任意 两条 边 都 没有公共顶点 。例如,图 、图 中红色的边就是图 ...
分类:其他好文   时间:2020-05-04 15:04:13    阅读次数:55
【字符串】556. 下一个更大元素 III
题目: 解答: 1 class Solution { 2 public: 3 vector<int> digits(int n) 4 { 5 vector<int> res; 6 while (n > 0) 7 { 8 res.push_back(n % 10); 9 n /= 10; 10 } 1 ...
分类:其他好文   时间:2020-05-04 13:39:01    阅读次数:64
【字符串】678. 有效的括号字符串
题目: 解答: 这道题因为只需要判断是否可以构成有效的括号,并不需要列举出合法的解。可以直接遍历一遍字符串,记录出现的括号和*的情况。 1 class Solution { 2 public: 3 bool checkValidString(string s) 4 { 5 // left和star分 ...
分类:其他好文   时间:2020-05-04 13:27:25    阅读次数:44
object and ptr
1, #include <iostream> #include <string> #include <vector> #include <memory> using namespace std; class fruit { public: int *idx ; }; int prodoucer(ve ...
分类:其他好文   时间:2020-05-04 13:20:07    阅读次数:59
【字符串】848. 字母移位
题目: 解答: 1 class Solution { 2 public: 3 string shiftingLetters(string S, vector<int>& shifts) 4 { 5 int size = (int)S.size(); 6 int cnt = 0; 7 for (int ...
分类:其他好文   时间:2020-05-04 13:18:50    阅读次数:49
Python基础(二)
一、类与对象和构造函数 class Point: def __init__(self,x,y): self.x = x self.y = y def move(self): print("move") def draw(self): print("draw") 创建一个对象 point1 = Poi ...
分类:编程语言   时间:2020-05-04 13:16:49    阅读次数:54
【字符串】647. 回文子串
题目: 解答: 1 class Solution { 2 public: 3 int countSubstrings(string s) 4 { 5 // 中心扩展法 6 int ans = 0; 7 for (int center = 0; center < 2 * s.length() - 1; ...
分类:其他好文   时间:2020-05-04 13:04:29    阅读次数:67
递归函数
什么是递归函数? 如果一个函数在内部不调用其他函数,而是它本身的话,就是递归函数 例如求n的阶乘(1*2*3*4*....*n) # 函数做法 def Factorial(num): i =1 result =1 while i <= num: result *= i i +=1 return re ...
分类:其他好文   时间:2020-05-04 13:00:54    阅读次数:62
Java注解和反射
注解 什么是注解 Annotation是从JDK5.0开始引入的新技术 Annotation的作用: 不是程序本身,可以对程序作出解释。(这一点和注释(comment)没什么区别) 可以被其他程序(比如:编译器等)读取。 Annotation的格式: 注解是以"@注释名"在代码中存在的,还可以添加一 ...
分类:编程语言   时间:2020-05-04 11:49:25    阅读次数:63
【字符串】6. Z 字形变换
题目: 解答: 1 class Solution { 2 public: 3 string convert(string s, int numRows) 4 { 5 if (numRows == 1) 6 { 7 return s; 8 } 9 10 // 防止s的长度小于行数 11 vector< ...
分类:其他好文   时间:2020-05-04 10:40:43    阅读次数:63
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!