自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

tkzc_csk的博客

不断学习

  • 博客(289)
  • 资源 (1)
  • 收藏
  • 关注

原创 剑指offer -- 判断一棵树是否为平衡二叉树

题目描述输入一棵二叉树,判断该二叉树是否是平衡二叉树。AC代码public class Solution { public boolean IsBalanced_Solution(TreeNode root) { return getDepth(root) != -1; } //返回值为 -1 表示 root 不是平衡树 pr...

2019-06-05 15:43:18 602

原创 剑指offer -- 字符串的排列

题目描述输入一个字符串,按字典序打印出该字符串中字符的所有排列。例如输入字符串abc,则打印出由字符a,b,c所能排列出来的所有字符串abc,acb,bac,bca,cab和cba。输入描述:输入一个字符串,长度不超过9(可能有字符重复),字符只包括大小写字母。AC代码1import java.util.ArrayList;public class Solution { A...

2019-05-29 10:17:39 253

原创 剑指offer -- 矩阵覆盖

题目描述我们可以用21的小矩形横着或者竖着去覆盖更大的矩形。请问用n个21的小矩形无重叠地覆盖一个2*n的大矩形,总共有多少种方法?AC代码public class Solution { public int RectCover(int target) { if(target <= 0) return 0; if(target == 1) ret...

2019-05-20 21:33:21 270

原创 java.io.IOException: Could not locate executable null\bin\winutils.exe in the Hadoop binaries.

如何解决winutils.exe的问题什么原因导致的???windows是客户端,读取linux的文件。客户端没有hadoop的环境重新在windows上面编译hadoop,编译出来window版本的客户端。解决办法:下载hadoop对应版本的 winutils https://github.com/LUK-qianliu/winutils-master把winutils/bin下面...

2019-05-09 19:39:59 240

转载 【转】Ubuntu16.04 关闭和开启图形界面

转载自:https://blog.csdn.net/zw__chen/article/details/86621103关闭用户图形界面,使用tty登录。sudo systemctl set-default multi-user.targetsudo reboot开启用户图形界面。sudo systemctl set-default graphical.targetsudo reboot...

2019-05-07 22:24:08 1134 1

原创 leetcode -- 714. Best Time to Buy and Sell Stock with Transaction Fee

题目描述题目难度:MediumYour are given an array of integers prices, for which the i-th element is the price of a given stock on day i; and a non-negative integer fee representing a transaction fee.You may c...

2019-04-21 15:43:27 155

原创 leetcode -- 122. Best Time to Buy and Sell Stock II

题目描述题目难度:EasySay you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete as many transactions as you like...

2019-04-21 15:04:15 150

原创 leetcode -- 946. Validate Stack Sequences

题目描述题目难度:MediumGiven two sequences pushed and popped with distinct values, return true if and only if this could have been the result of a sequence of push and pop operations on an initially empty s...

2019-04-17 10:01:39 172

原创 给定入栈顺序,输出所有可能出栈情况及所有情况的总数

代码借鉴自:https://blog.csdn.net/qq_42194192/article/details/82717888import java.util.*;public class Test{ static char[] in={'1','2','3'}; public static void main(String[] args){ fun(...

2019-04-17 09:59:37 893

原创 迷宫寻路

题目描述假设一个探险家被困在了地底的迷宫之中,要从当前位置开始找到一条通往迷宫出口的路径。迷宫可以用一个二维矩阵组成,有的部分是墙,有的部分是路。迷宫之中有的路上还有门,每扇门都在迷宫的某个地方有与之匹配的钥匙,只有先拿到钥匙才能打开门。请设计一个算法,帮助探险家找到脱困的最短路径。如前所述,迷宫是通过一个二维矩阵表示的,每个元素的值的含义如下 0-墙,1-路,2-探险家的起始位置,3-迷宫的出...

2019-04-16 16:10:11 566

原创 【转】小船过河问题(贪心)

转载自:https://www.cnblogs.com/ALL-pp/p/6204138.html题意:N个人过河,船每次只能坐两个人,船载每个人过河的所需时间不同t[i],每次过河的时间为船上的人的较慢的那个,问最快的过河时间。(船划过去要有一个人划回来)最优选择:先将所有人过河所需的时间按照升序排序,我们考虑把单独过河所需要时间最多的两个旅行者(为什么是两个?因为最慢的过河的时候可以带...

2019-04-15 20:51:38 1600

原创 leetcode -- 416. Partition Equal Subset Sum

题目描述题目难度:MediumGiven a non-empty array containing only positive integers, find if the array can be partitioned into two subsets such that the sum of elements in both subsets is equal.Note:Each of ...

2019-04-15 20:27:00 162

原创 【转】彻底理解0-1背包问题

转载自:https://blog.csdn.net/chanmufeng/article/details/829557300-1背包问题0-1背包问题指的是每个物品只能使用一次递归方法public class KnapSack01 { /** * 解决背包问题的递归函数 * * @param w 物品的重量数组 * @para...

2019-04-15 20:16:56 311

原创 2019.4.12 广联达实习生笔试 -- 最大面积

题目描述如图,有一块面积很大的地,这块地已经被划分为了无数个1x1的方块,现在,我们商定了一种圈定方法:以任意一个方块的顶点为圆心画一个圆,圆中所有的完整小方块就是属于你的土地,如果所画的圆半径为N(N为整数),请问能圈到多少地?输入:半径N输出:圈到的面积(方块个数)M例如:输入N = 3,输出16.AC代码public void area(int r){ if(r &l...

2019-04-13 21:48:24 1921 2

原创 leetcode --415. Add Strings(大数相加)

题目描述题目难度:EasyGiven two non-negative integers num1 and num2 represented as string, return the sum of num1 and num2.Note:The length of both num1 and num2 is < 5100.Both num1 and num2 contains on...

2019-04-09 10:55:36 618

原创 2019.4.5 腾讯暑期实习生常规批后台开发笔试

晚上七点半开始的笔试,两个小时,20个不定项选择题(少选不得分),3道编程题。先说一说不定项选择题,涉及到的知识有TCP和UDP的区别(有无连接、TCP是否支持一对一,一对多,多对一,多对多)平衡二叉树的高度以及调整栈(入栈顺序是1,2,3、、、n,出栈顺序是s1,s2,s3,s2 = 2,问s1,s3等可能或者不可能出现的值)最小堆的删除(删除最小堆的堆顶元素后剩下的元素的顺序是怎么...

2019-04-06 23:28:33 385

原创 leetcode -- 121. Best Time to Buy and Sell Stock

题目描述题目难度:EasySay you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one transaction (i.e., buy one and sell one share ...

2019-04-04 11:33:03 183

原创 leetcode -- 547. Friend Circles(并查集的应用)

题目描述题目难度:MediumThere are N students in a class. Some of them are friends, while some are not. Their friendship is transitive in nature. For example, if A is a direct friend of B, and B is a direct f...

2019-04-04 11:10:48 216

转载 【转】腾讯2017暑期实习生笔试题 - 构造回文

参考:https://blog.csdn.net/zr1076311296/article/details/51723040題目描述解题思路仔细想一想,将字符串逆序后与原来的字符串求最长公共子序列不就是这个构造回文吗?这应该很好理解吧,下面简单科普一下最长公共子序列:这中序列不是连续的,意思是可以有间隔,去掉那些干扰项以后,两个序列完全相同,而且要求这个子序列最长。这类问题和之前 lee...

2019-04-03 17:15:42 229

原创 leetcode -- 236. Lowest Common Ancestor of a Binary Tree(LCA,最近公共祖先节点)

题目描述题目难度:MediumGiven a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined betw...

2019-04-03 17:11:19 107

原创 leetcode -- 120. Triangle

题目描述题目难度:MediumGiven a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given the following triangle[[2],[3,4],[6...

2019-04-03 10:26:42 95

原创 leetcode -- 119. Pascal's Triangle II

题目描述题目难度:EasyGiven a non-negative index k where k ≤ 33, return the kth index row of the Pascal’s triangle.Note that the row index starts from 0.Example:Input: 3Output: [1,3,3,1]Follow up:Coul...

2019-04-03 09:35:28 101

转载 【转】JDK8:HashMap源码解析:resize方法

原文:https://blog.csdn.net/weixin_42340670/article/details/80503517一、概述HashMap的resize方法的作用:在向HashMap里put元素的时候,HashMap基于扩容规则发现需要扩容的时候会调用该方法来进行扩容。二、方法解析final Node<K,V>[] resize() { Node&...

2019-04-02 18:33:46 167

原创 leetcode -- 116. Populating Next Right Pointers in Each Node

题目描述题目难度:MediumYou are given a perfect binary tree where all leaves are on the same level, and every parent has two children. The binary tree has the following definition:struct Node {int val;Nod...

2019-04-01 14:51:16 144

原创 leetcode -- 115. Distinct Subsequences

题目描述题目难度:HardGiven a string S and a string T, count the number of distinct subsequences of S which equals T.A subsequence of a string is a new string which is formed from the original string by del...

2019-04-01 13:12:34 105

原创 leetcode -- 114. Flatten Binary Tree to Linked List

题目描述题目难度:MediumGiven a binary tree, flatten it to a linked list in-place.For example, given the following tree:AC代码leetcode上面一位大神的解法/** * Definition for a binary tree node. * public class Tre...

2019-04-01 09:32:19 120

原创 leetode -- 113. Path Sum II

题目描述题目难度:MediumGiven a binary tree and a sum, find all root-to-leaf paths where each path’s sum equals the given sum.Note: A leaf is a node with no children.AC代码/** * Definition for a binary tr...

2019-03-25 11:30:06 136

原创 leetcode -- 112. Path Sum

题目描述题目难度:EasyGiven 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.Note: A leaf is a node with no child...

2019-03-25 11:17:08 168

原创 leetcode -- 111. Minimum Depth of Binary Tree

题目描述题目难度:EasyGiven 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.Note: A leaf is a node wi...

2019-03-25 10:54:08 94

原创 leetcode -- 110. Balanced Binary Tree

题目描述题目难度:EasyGiven a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as:a binary tree in which the depth of the two subtrees of every nod...

2019-03-25 10:29:12 415

原创 leetcode -- 109. Convert Sorted List to Binary Search Tree

题目描述题目难度:MediumGiven a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.For this problem, a height-balanced binary tree is defined as a binary tr...

2019-03-25 10:19:47 137

原创 leetcode -- 108. Convert Sorted Array to Binary Search Tree

题目描述题目难度:EasyGiven an array where elements are sorted in ascending order, convert it to a height balanced BST.For this problem, a height-balanced binary tree is defined as a binary tree in which th...

2019-03-21 15:57:16 120

原创 2019.3.20 华为实习生机试题

第一题题目描述要开发一款教育类APP,帮助幼儿在识数阶段做一百以内自然数[0,99]的加减法。屏幕上会显示"0", “1”,“2”,“3”, “4”, “5”, “6”, “7”, “8”,“9”,"+","-","=“这些按钮,用户在按了若干按钮之后,如果按了”=",则会把"="之前的字符串作为一个算式,计算结果。中间结果或最后结果可以为负数。输入描述输入为一个字符串,形如"23+86-...

2019-03-21 15:20:06 1322

原创 Leetcode -- 107. Binary Tree Level Order Traversal II

题目描述题目难度:EasyGiven a binary tree, return the bottom-up level order traversal of its nodes’ values. (ie, from left to right, level by level from leaf to root).AC代码1BFS解法/** * Definition for a bi...

2019-03-20 16:03:25 86

转载 传输层TCP和UDP的区别分析与应用场景

参考文章:https://blog.csdn.net/u013777351/article/details/49226101https://blog.csdn.net/weixin_42385626/article/details/81983594基本概念:1: 面向报文面向报文的传输方式是应用层交给UDP多长的报文,UDP就照样发送,即一次发送一个报文。因此,应用程序必须选择合适大...

2019-03-20 15:05:05 241

转载 聚集索引和非聚集索引

参考文章:https://www.jianshu.com/p/5681ebd5b0efhttps://www.cnblogs.com/weixing/p/4317774.htmlhttps://www.cnblogs.com/s-b-b/p/8334593.html一.索引简介众所周知,索引是关系型数据库中给数据库表中一列或多列的值排序后的存储结构,SQL的主流索引结构有B+树以及Has...

2019-03-20 14:34:49 386

转载 【转】[数据库] 理解数据库范式-通俗易懂

转载自:https://www.cnblogs.com/lca1826/p/6601395.html数据库范式是数据库设计中必不可少的知识,没有对范式的理解,就无法设计出高效率、优雅的数据库。甚至设计出错误的数据库。而想要理解并掌握范式却并不是那么容易。教科书中一般以关系代数的方法来解释数据库范式。这样做虽然能够十分准确的表达数据库范式,但比较抽象,不太直观,不便于理解,更难以记忆。  本文用...

2019-03-20 11:29:16 205

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

题目描述题目难度:MediumGiven inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.AC代码/** * Definition for a binary tree no...

2019-03-20 11:25:01 79

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

题目描述题目难度:MediumGiven preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.AC代码/** * Definition for a binary tree nod...

2019-03-20 10:55:21 96

转载 TCP三次握手 四次挥手

参考文章:https://www.cnblogs.com/zhuzhenwei918/p/7465467.htmlhttps://www.cnblogs.com/cenglinjinran/p/8482412.htmlTCP三次握手首先,我们要知道TCP是全双工的,即客户端在给服务器端发送信息的同时,服务器端也可以给客户端发送信息。而半双工的意思是A可以给B发,B也可以给A发,但是A在给B...

2019-03-19 20:28:03 146

MNIST数据集

MNIST数据集下载:MNIST是深度学习的经典入门demo,它是由6万张训练图片和1万张测试图片构成的,每张图片都是28*28大小,而且都是黑白色构成(这里的黑色是一个0-1的浮点数,黑色越深表示数值越靠近1),这些图片是采集的不同的人手写从0到9的数字。

2018-02-18

空空如也

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

TA关注的人

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