摘要: class TreeNode { int val; TreeNode left; TreeNode right; } class Solution { private Queuecur=new ArrayDeque(); private Queuenext=new ArrayDeque(); //两个队列交互使用来达到一个层层递进的效果从而完成层序遍历... 阅读全文
posted @ 2019-10-24 13:47 pycodego 阅读(809) 评论(1) 推荐(0) 编辑
摘要: class Solution { private int[][] dir= {{0,-1},{-1,0},{0,1},{1,0}}; private boolean[][] used; public boolean isMove(char[][] board,int x,int y) { if(x>=0&&x=0&&y一旦发现有0则立即调用dfs将... 阅读全文
posted @ 2019-10-24 12:20 pycodego 阅读(120) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> 阅读全文
posted @ 2019-10-23 21:12 pycodego 阅读(118) 评论(0) 推荐(0) 编辑
摘要: class Solution { private: int in=0; int sum=0; //保留最大的利润值 public: int maxProfit(vector& prices) { in=prices[0]; for(int i=0;iin) sum=Max(sum,prices[i]-in); else if... 阅读全文
posted @ 2019-10-23 19:46 pycodego 阅读(158) 评论(0) 推荐(0) 编辑
摘要: 一般的求数组中连续的最大,最小值时,通常的解法思路就是------>一直往前,当其不满足某个条件时就直接在这截止,再重新以当前位置为起点再出发class Solution { public int maxSubArray(int[] nums) { int ans = nums[0]; int sum = 0; for(int num: n... 阅读全文
posted @ 2019-10-23 12:00 pycodego 阅读(164) 评论(0) 推荐(0) 编辑
摘要: #include "mywidget.h" MyWidget::MyWidget(QWidget *parent) : QWidget(parent) { b1.setParent(this); b1.setText("切换到子窗口"); b1.move(100,100); resize(400,400); connect(&b1,&QPushB... 阅读全文
posted @ 2019-10-17 19:38 pycodego 阅读(490) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <string> #pragma warning(disable:4996) using namespace std; int main(){ string str; int T = 0; scanf("%d ", &T); 新的知识scanf("%d ",&T)加空格可以带走换行符 while (T) { int res = 0; T-- 阅读全文
posted @ 2019-10-13 11:25 pycodego 阅读(277) 评论(0) 推荐(0) 编辑
摘要: import java.util.*; class node implements Comparable<node> { int begin; int end; @Override public int compareTo(node arg0) { if(this.begin==arg0.begin)return this.end-arg0.end; else return this.begin- 阅读全文
posted @ 2019-10-13 10:13 pycodego 阅读(195) 评论(0) 推荐(0) 编辑
摘要: import java.math.BigDecimal; import java.math.BigInteger; import java.util.*; class solution { private BigInteger m,n; private int T=0; private int Index=1; private Scanner iner=new Scanner(Syst... 阅读全文
posted @ 2019-10-12 08:59 pycodego 阅读(448) 评论(0) 推荐(1) 编辑
摘要: package com.acm; import java.util.*; class solution { private String str="0123456789ABCDEF"; private int m,n; private Scanner iner=new Scanner(System.in); private StringBuilder des=new StringBuilder() 阅读全文
posted @ 2019-10-12 08:44 pycodego 阅读(135) 评论(0) 推荐(0) 编辑