- 博客(10)
- 收藏
- 关注
转载 合并K个排序链表
public class Solution { public ListNode mergeKLists(List<ListNode> lists) { if (lists.size() == 0) { return null; } return mergeHelper(lists, 0, lists.siz...
2017-08-28 19:26:00
71
转载 两个整数相除
classSolution{public:/***@paramdividendthedividend*@paramdivisorthedivisor*@returntheresult*/intdivide(intdividend,intdiviso...
2017-08-28 19:23:00
215
转载 左填充
static string leftPad(string& originalStr,int size,char padChar = ''){ int len = originalStr.size(); if (size < len) { return originalStr; } int k = size - len; st...
2017-08-28 19:20:00
104
转载 整数转罗马数字
class Solution { public: string intToRoman(int num) { vector<vector<string>> strR= { {"", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "...
2017-08-28 19:19:00
62
转载 主元素
int getMain(int* a, int length){ int count =0; int seed = a[0]; for(int i=0; i<length; i++){ if(a[i]==seed) count++; else if(count>0) count--; else ...
2017-08-28 19:19:00
102
转载 在0(1)时间复杂度删除链表节点
/** * Definition of ListNode * class ListNode { * public: * int val; * ListNode *next; * ListNode(int val) { * this->val = val; * this->next = NULL; * ...
2017-08-28 19:17:00
53
转载 跳跃游戏
class Solution { public: /** * @param A: A list of integers * @return: The boolean answer */ bool func(vector<int> A, int i, int size) { if (i >= s...
2017-08-28 19:15:00
67
转载 前序遍历 中序遍历树构造二叉树
/** * Definition of TreeNode: * public class TreeNode { * public int val; * public TreeNode left, right; * public TreeNode(int val) { * this.val = val; * this.left = t...
2017-08-28 19:14:00
67
转载 判断数独是否合法
class Solution { /** * @param board: the board @return: wether the Sudoku is valid */ public boolean isValidSudoku(char[][] board) { int r[][] = new int[9]...
2017-08-28 18:32:00
85
转载 比较字符串
#include <iostream>using namespace std;int main(int argc, char *argv[]){ char str1[] = "abc"; char str2[] = "abc"; const char str3[] = "abc"; const char str4[] =...
2017-08-28 18:30:00
85
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人