- 博客(11)
- 收藏
- 关注
原创 剑指Offer中很有意思的题目摘要
面试题12- 矩阵中的路径:static char[][] ch = {{'a', 'e', 't', 'g'}, {'c', 'f', 'c', 's'}, {'j', 'd', 'e', 'h'}};static String s = "bfce";static b
2018-03-28 22:36:42 458
原创 1022. Digital Library (30)
Digital Library题目阐述 A Digital Library contains millions of books, stored according to their titles, authors, key words of their abstracts, publishers, and published years. Each book is assigned ...
2018-03-29 16:40:28 111
原创 1024. Palindromic Number (25)
Palindromic Number A number that will be the same when it is written forwards or backwards is known as a Palindromic Number. For example, 1234321 is a palindromic number. All single digit numbers ...
2018-03-28 19:09:43 122
原创 1021. Deepest Root (25)
Deepest Root题目阐述 A graph which is connected and acyclic can be considered a tree. The height of the tree depends on the selected root. Now you are supposed to find the root that results in a h...
2018-03-27 18:28:49 142
原创 C/C++语言学习记录
C/C++语言学习笔记及简单程序Demo记录1- 判别素数小程序#include <iostream>#include <stdio.h>using namespace std;int isPrime(int);int main() { int a; cin >> a; while (a != -1) {...
2018-03-26 09:51:10 261
原创 2018-PAT春季考试小结
2018PAT春季考试小结暑假找工作,第一次考PAT,其实去年冬天就想试试水的,但年底开题+开组会,最终还是没报名。等到快放寒假了加上一个春节的时间,想着再家里看能刷刷题么,结果无数次的实验还是证明了一件事,那就是对于我,在家里休想学习。过完春节3月6号到了学校,其实离18号考试也就只剩12天了,我的基础,也只是之前在leetcode上刷过200题而已,然而在PAT官网上只刷了14道,每一道...
2018-03-18 19:26:43 8200 11
原创 PAT-Java-1033. To Fill or Not to Fill (25)
To Fill or Not to Fill题目描述 With highways available, driving a car from Hangzhou to any other city is easy. But since the tank capacity of a car is limited, we have to find gas stations on the ...
2018-03-14 22:41:26 221
原创 PAT-Java-Is It a Complete AVL Tree (30)
Is It a Complete AVL Tree题目阐述 An AVL tree is a self-balancing binary search tree. In an AVL tree, the heights of the two child subtrees of any node differ by at most one; if at any time they d...
2018-03-14 17:12:27 258 3
原创 《编程之美》-二分查找的实现
二分查找 找出一个有序的字符串数组arr中值等于字符串v的元素的序号,并返回其序号,否则返回-1;private static int binarySearch(String[] arr, String str) { int l = 0, r = arr.length-1; while (l <= r) { int mid = l + (r-...
2018-03-12 19:57:24 188
原创 PAT-Java-Head of a Gang(30)
Head of a Gang题目描述 One way that the police finds the head of a gang is to check people’s phone calls. If there is a phone call between A and B, we say that A and B is related. The weight of a ...
2018-03-12 09:57:39 165
原创 背包问题
01背包问题 0-1背包,最简单的背包问题 包裹里能装N件物品,每一件价值Wi,耗费Ci,总耗空间不超过V,求W的最大值; 状态转移方程:F[i, v] = max{F[i-1, v], F[i-1, v-Ci] + Wi}; 如何理解状态转移方程?F[i, v]表示面对前i件物品,容量为v的背包中可获得的最大价值; private static void ...
2018-03-06 21:45:36 188 1
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人