White's Studio.

White's Studio.

it's better to burn out than to fade away

Leetcode-23.合并k个排序链表
Leetcode-23.合并k个排序链表题目:合并 k 个排序链表,返回合并后的排序链表。请分析和描述算法的复杂度。 示例: 1234567输入:[ 1->4->5, 1->3->4, 2->6]输出: 1->1->2->3->4->4->5->6 之前还遇到过一题: 合并两个排序链表,返回合并后的排序链表。 将两个有序链表合并为一个新的有序链表并返回。新链表是通过拼接给定的两个链表的所有节点组成的。 示例: 12输入:1->2->4, 1->3->4输出:1->1->2...
Leetcode-89.格雷编码
Leecode-89.格雷编码题目:格雷编码是一个二进制数字系统,在该系统中,两个连续的数值仅有一个位数的差异。 给定一个代表编码总位数的非负整数 n,打印其格雷编码序列。格雷编码序列必须以 0 开头。 示例 1: 123456789101112131415输入: 2输出: [0,1,3,2]解释:00 - 001 - 111 - 310 - 2对于给定的 n,其格雷编码序列并不唯一。例如,[0,2,3,1] 也是一个有效的格雷编码序列。00 - 010 - 211 - 301 - 1 示例 2: 12345输入: 0输出: [0]解释: 我们定义格雷编码序列必须以 0 开头。 ...
LinCode - Backpack IIFollow
LinCode - Backpack IIFollowDescriptionGiven n items with size Ai and value Vi, and a backpack with size m. What’s the maximum value can you put into the backpack? You cannot divide item into small pieces and the total size of items you choose should smaller or equal to m. Have you met this questi...
如何使用 Spring Boot 初始一个 webService 项目
如何使用 Spring Boot 初始一个 webService 项目本文会练习使用IDE建立一个 mongodb 的简单 web 服务,尽量会很详细,做到初次看的也能建立成功。 1. 使用 IDEJava 开发推荐使用 IDE,可以免去你很多麻烦。 第一步,建立你的项目: File->New->Project… ,选择 Spring Initializr 默认点击 Next-> 就好了 选择依赖,本项目先起一个简单的 mongodb web 服务,所以选择了 web 和 mongodb 的 dependencies, 然后点击 next 最后一步也点击 ne...
Lintcode- 562.Backpack IVFollow
Lintcode- 562.Backpack IVFollowDescriptionGiven n items with size nums[i] which an integer array and all positive numbers, no duplicates. An integer target denotes the size of a backpack. Find the number of possible fill the backpack. 1Each item may be chosen unlimited number of times Have you me...
LintCode- 669. Coin ChangeFollow
LintCode- 669. Coin ChangeFollowDescriptionYou are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you need to make up that amount. If that amount of money cannot be made up by any combination of the coins, ret...
LintCode-440. Backpack IIIFollow
LintCode-440. Backpack IIIFollowDescriptionGiven n kind of items with size Ai and value Vi( each item has an infinite number available) and a backpack with size m. What’s the maximum value can you put into the backpack? You cannot divide item into small pieces and the total size of items you choo...
LintCode-91. Minimum Adjustment Cost
LintCode-91. Minimum Adjustment Cost91. Minimum Adjustment Cost DescriptionGiven an integer array, adjust each integers so that the difference of every adjacent integers are not greater than a given number target. If the array before adjustment is A, the array after adjustment is B, you should mi...
Java的Array.sort涉及的算法运用
Array.sort涉及的算法运用问题1:Java的sort方法用到什么样的排序算法1.归并排序(数组类型为object对象类型) 2.快速排序 (数组类型为原型数据类型) 辅助的其他几种排序 (数组长度小时) 3.冒泡排序 问题2:为什么需要用不同种算法结合?这个涉及到算法的两个复杂度 时间复杂度——用来检验某个算法处理一定量的数据要花多长时间 空间复杂度——对一个算法在运行过程中临时占用存储空间大小的量度 归并排序 拆分阶段,将序列分为更小的序列 排序阶段,把小的序列合在一起(使用合并算法)来构成更大的序列 代码链接: 优点:它的时间复杂度为O(nlogn),同时是一种...
White
witness me