- 博客(9)
- 资源 (2)
- 收藏
- 关注
原创 LeetCode第797题 All Paths From Source to Target
class Solution {public: vector<vector<int>> paths; void findPath(vector<vector<int>> &graph ,vector<int> path,int x,int target) { if(x==target) ...
2018-04-07 21:25:56 181
原创 动态规划
copy#include <iostream> #include <algorithm> using namespace std; #define MAX 101 int D[MAX][MAX]; int n; int maxSum[MAX][MAX]; int main(){ int i,j; ...
2018-04-07 12:55:41 113
原创 LeetCode 789
class Solution {public: bool escapeGhosts(vector<vector<int>>& ghosts, vector<int>& target) { int myDistance=fabs(target[0])+fabs(target[1]); for(int i=0;i&...
2018-04-06 22:30:35 180
原创 DFS
#include <iostream>#include <stack>#define N 5using namespace std;int maze[N][N] ={ {0,1,1,0,0}, {0,0,1,0,1}, {0,0,1,0,0}, {1,1,0,0,1}, {0,0,1,0,0}};int visited[N+1]={0};void DFS...
2018-04-06 16:08:40 115
原创 BFS
#include <iostream>#include <queue>#define N 5using namespace std;int maze[N][N]={{0,1,1,0,0},{0,0,1,1,0},{0,1,1,1,0},{0,0,1,1,0}};int visited[N+1]={0};void BFS(int start){ queue<int...
2018-04-06 15:36:14 115
原创 LeetCode787题
There are n cities connected by m flights. Each fight starts from city u and arrives at v with a price w.Now given all the cities and fights, together with starting city src and the destination dst, y...
2018-04-06 14:06:15 378
原创 LeetCode第676题
Implement a magic directory with buildDict, and search methods.For the method buildDict, you'll be given a list of non-repetitive words to build a dictionary.For the method search, you'll be given a w...
2018-04-05 21:37:49 225
原创 LeetCode 695. Max Area of Island
Given a non-empty 2D array grid of 0's and 1's, an island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.) You may assume all four edges of the grid are surrou...
2018-04-02 00:54:11 132
原创 LeetCode第628题
Given an integer array, find three numbers whose product is maximum and output the maximum product.Example 1:Input: [1,2,3] Output: 6 Example 2:Input: [1,2,3,4] Output: 24 Note:The length of the given...
2018-04-01 17:11:05 126
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人