自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(108)
  • 收藏
  • 关注

转载 debug到自闭

1 #include <iostream> 2 #include <algorithm> 3 #include <cmath> 4 using namespace std; 5 typedef long long LL; 6 const int N = 1010; 7 LL A[N]; 8 LL B[N]; 9 L...

2019-05-19 11:56:00 155

转载 大数乘法模拟

1 // 手动模拟大整数乘法 2 // 使用c++ 里的vector来储存数据 3 // 并且倒着储存数字 4 // 时间复杂度o(n2) 5 void normalize(vector<int>& num){ 6 // n 位 * m 位相乘最多生成n + m位 7 num.push_back(0); 8 ...

2019-05-16 21:02:00 184

转载 线性同余方程

// 定理一:对于方程a * x + b * y = c 有整数解 x, y 可以转化为a * x 三 c(mod b)// 根据扩展欧几里得算法可知,a * x0 + b * y0 = GCD( a, b)一定有解, 此时将方程左右同时出去GCD( a, b)在乘上c// 方程就转化成了a * x0 * c / GCD( a, b) + b * y0 * c / GCD( ...

2019-05-16 16:18:00 205

原创 121. Best Time to Buy and Sell Stock & 122 II & 123 III & 188 IV

DP;Greedy

2016-02-25 19:49:30 442

原创 120. Triangle

Given a triangle, find the minimum path sum from top to bottom.

2016-02-10 19:30:46 288

原创 118. Pascal's Triangle && 119. Pascal's Triangle II

Given numRows, generate the first numRows of Pascal’s triangle

2016-02-05 21:01:53 307

原创 116. Populating Next Right Pointers in Each Node && 117. II

BFS

2016-02-03 21:34:38 276

原创 115. Distinct Subsequences

Given a string S and a string T, count the number of distinct subsequences of T in S.

2016-02-03 18:37:32 294

原创 114. Flatten Binary Tree to Linked List

Given a binary tree, flatten it to a linked list in-place

2016-02-03 18:23:29 322

原创 112. Path Sum && 113. Path Sum II

Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.

2016-02-03 18:10:00 293

原创 111. Minimum Depth of Binary Tree

Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.

2016-02-03 17:44:30 269

原创 110. Balanced Binary Tree

Given a binary tree, determine if it is height-balanced.

2016-02-03 17:38:10 216

原创 109. Convert Sorted List to Binary Search Tree

Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.

2016-02-03 17:18:40 248

原创 108. Convert Sorted Array to Binary Search Tree

Given an array where elements are sorted in ascending order, convert it to a height balanced BST.

2016-02-03 16:58:41 235

原创 106. Construct Binary Tree from Inorder and Postorder Traversal

Given inorder and postorder traversal of a tree, construct the binary tree.

2016-02-03 16:49:47 322

原创 105. Construct Binary Tree from Preorder and Inorder Traversal

Given preorder and inorder traversal of a tree, construct the binary tree.

2016-02-03 16:48:18 312

原创 104. Maximum Depth of Binary Tree

Given a binary tree, find its maximum depth.

2016-02-03 14:12:35 231

原创 103. Binary Tree Zigzag Level Order Traversal

Given a binary tree, return the zigzag level order traversal of its nodes’ values.

2016-02-03 14:10:17 200

原创 102. Binary Tree Level Order Traversal && 107. Binary Tree Level Order Traversal II

层序遍历

2016-01-28 17:11:24 224

原创 101. Symmetric Tree

Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).

2016-01-28 17:00:01 312

原创 100. Same Tree

Given two binary trees, write a function to check if they are equal or not.

2016-01-28 16:40:48 204

原创 99. Recover Binary Search Tree

Two elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.

2016-01-28 16:36:32 629

原创 98. Validate Binary Search Tree

Given a binary tree, determine if it is a valid binary search tree (BST).

2016-01-28 16:07:38 244

原创 97. Interleaving String

DP

2016-01-28 11:30:31 196

原创 96. Unique Binary Search Trees && 95. Unique Binary Search Trees II

DP DFS

2016-01-27 18:11:16 172

原创 94. Binary Tree Inorder Traversal

Given a binary tree, return the inorder traversal of its nodes’ values.

2016-01-26 20:14:49 189

原创 93. Restore IP Addresses

DFS

2016-01-26 17:17:22 183

原创 206. Reverse Linked List && 92. Reverse Linked List II

Reverse a singly linked list.

2016-01-26 16:45:31 224

原创 91. Decode Ways

DP

2016-01-26 14:48:03 232

原创 89. Gray Code

The gray code

2016-01-26 11:28:04 210

原创 88. Merge Sorted Array

Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.

2016-01-25 23:03:58 181

原创 87. Scramble String

此题可以用动态规划来做。也可以用递归来做

2016-01-25 23:00:22 585

原创 86. Partition List

linked list

2016-01-25 22:38:57 201

原创 85. Maximal Rectangle

stack

2016-01-25 22:33:59 214

原创 84. Largest Rectangle in Histogram

stack

2016-01-25 22:29:16 427

原创 83. Remove Duplicates from Sorted List && 82. Remove Duplicates from Sorted List II

Given a sorted linked list, delete all duplicates such that each element appear only once.

2016-01-25 22:20:37 191

原创 83. Remove Duplicates from Sorted List && 82. Remove Duplicates from Sorted List II

Given a sorted linked list, delete all duplicates such that each element appear only once.

2016-01-25 19:22:58 178

原创 79. Word Search

DFS

2016-01-21 20:51:11 206

原创 78. Subsets && 90. Subsets II

Subset

2016-01-21 20:45:07 287

原创 77. Combinations

DFS

2016-01-21 20:22:57 250

空空如也

空空如也

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

TA关注的人

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