E-COM-NET
首页
在线工具
Layui镜像站
SUI文档
联系我们
推荐频道
Java
PHP
C++
C
C#
Python
Ruby
go语言
Scala
Servlet
Vue
MySQL
NoSQL
Redis
CSS
Oracle
SQL Server
DB2
HBase
Http
HTML5
Spring
Ajax
Jquery
JavaScript
Json
XML
NodeJs
mybatis
Hibernate
算法
设计模式
shell
数据结构
大数据
JS
消息中间件
正则表达式
Tomcat
SQL
Nginx
Shiro
Maven
Linux
【HackerRank】
*[
hackerrank
]Tree Covering
https://www.
hackerrank
.com/contests/illuminati/challenges/tree-covering 这道题先是在上次交流讨论了一下,然后两位百度的朋友先写完代码
·
2015-11-11 09:11
tree
Hackerrank
2020 February 2014 解题报告
Hackerrank
2020 February 2014 解题报告 比赛链接 Sherlock
·
2015-11-11 01:26
rank
hackerrank
【Lego Blocks】:计数类dp
题目大意: 修一个层数为n,长度为m的墙,每一层可以由长度为1、2、3、4的砖块构成。 每一层都在同一个长度处出现缝隙是方案非法的,问合法的方案数有多少种 思路: 先求出总方案,再减去所有非法的方案数 总方案数容易求得,略 非法方案数就不太好求了,由于需要判重,我们可以按照 " 最左边的缝隙 " 所在的位置给非法方案数分类 这样就不会有重复了! 具体见代码:
·
2015-11-08 14:35
block
hackerrank
:Almost sorted interval
题目链接:https://www.
hackerrank
.com/challenges/almost-sorted-interval 题目大意: 定义一个“几乎单调”区间(区间最小值在最左面,最大值在最右面
·
2015-11-08 14:34
sort
*[
hackerrank
]Similar Pair
https://www.
hackerrank
.com/contests/101hack/challenges/similarpair 这题有点意思。
·
2015-11-08 13:16
rank
*[
hackerrank
]Lexicographic paths
https://www.
hackerrank
.com/contests/w9/challenges/lexicographic-steps 这题还是折腾很久的。
·
2015-11-08 13:11
Graph
*[
hackerrank
]Jim Beam
https://www.
hackerrank
.com/contests/infinitum-aug14/challenges/jim-beam 学习了线段相交的判断法。
·
2015-11-08 13:10
rank
*[
hackerrank
]Volleyball Match
https://www.
hackerrank
.com/contests/w1/challenges/volleyball-match 此题不错,首先可以看出是DP,S(x, y)= S(x - 1,
·
2015-11-08 13:09
Volley
[
hackerrank
]Service Lane
https://www.
hackerrank
.com/challenges/service-lane 用RMQ做的,其实暴力也能过~ #include <iostream> #include
·
2015-11-08 13:09
service
*[
hackerrank
]Maximizing XOR
https://www.
hackerrank
.com/contests/w1/challenges/maximizing-xor/ 找了半天规律,答案竟然是暴力,伤感。
·
2015-11-08 13:08
rank
*[
hackerrank
]Cut the tree
https://www.
hackerrank
.com/contests/w2/challenges/cut-the-tree 树分成两部分,求两部分差最小。
·
2015-11-08 13:07
tree
[
hackerrank
]Manasa and Stones
https://www.
hackerrank
.com/contests/w2/challenges/manasa-and-stones 简单题。
·
2015-11-08 13:06
rank
*[
hackerrank
]Sam and sub-strings
https://www.
hackerrank
.com/contests/w3/challenges/sam-and-substrings DP。
·
2015-11-08 13:06
String
[
hackerrank
]The Love-Letter Mystery
https://www.
hackerrank
.com/contests/w3/challenges/the-love-letter-mystery 简单题。
·
2015-11-08 13:05
rank
[
hackerrank
]Palindrome Index
简单题。 #include <iostream> #include <string> using namespace std; int main() { int T; cin >> T; while (T--) { string s; cin >> s;
·
2015-11-08 13:04
index
*[
hackerrank
]Algorithmic Crush
https://www.
hackerrank
.com/contests/w4/challenges/crush 第一眼觉得要用线段树,但据说会超时。其实这个可以通过生成pair排序来做。
·
2015-11-08 13:04
Algorithm
[
hackerrank
]Even Odd Query
https://www.
hackerrank
.com/contests/w5/challenges 简单题,注意整数的0次方是1,奇数。
·
2015-11-08 13:03
query
*[
hackerrank
]Consecutive Subsequences
https://www.
hackerrank
.com/contests/w6/challenges/consecutive-subsequences 求数组中被k整除的子段和有几个。
·
2015-11-08 13:02
sequence
[
hackerrank
]Closest Number
https://www.
hackerrank
.com/contests/w5/challenges/closest-number 简单题。
·
2015-11-08 13:02
number
*[
hackerrank
]ACM ICPC Team
https://www.
hackerrank
.com/contests/w6/challenges/acm-icpc-team 这道题在contest的时候数据量改小过,原来的数据量需要进行优化才能过
·
2015-11-08 13:01
rank
*[
hackerrank
]Chocolate in Box
https://www.
hackerrank
.com/contests/w7/challenges/chocolate-in-box Nim Game:http://www.cdf.toronto.edu
·
2015-11-08 13:00
rank
*[
hackerrank
]Die Hard 3
https://www.
hackerrank
.com/contests/w7/challenges/die-hard-3 首先,发现c <= max(a, b) 而且 c = aX + bY时有解
·
2015-11-08 13:59
rank
*[
hackerrank
]Girlfriend & Necklace
https://www.
hackerrank
.com/contests/w8/challenges/gneck 有点意思。是DP,最优解包含最优子问题。F(X)=F(X-1)+F(X-3)。
·
2015-11-08 13:59
rank
[
hackerrank
]John and GCD list
https://www.
hackerrank
.com/contests/w8/challenges/john-and-gcd-list 简单题,GCD和LCM。
·
2015-11-08 13:58
list
[hankerrank]Counter game
https://www.
hackerrank
.com/contests/w8/challenges/counter-game 关键是二分查找等于或最接近的小于target的数。
·
2015-11-08 13:57
count
*[
hackerrank
]Kundu and Tree
https://www.
hackerrank
.com/contests/w5/challenges/kundu-and-tree 此题是有一棵树,树中的边有红有黑。
·
2015-11-08 12:24
tree
Hackerrank
(2): Snapdeal Hackathon > Cycling
题目:ProblemStatementTheSnapdealdeliverypeopleridebikestodeliverproductstovariouspeoplearoundthecity.ThereareNdeliverypeoplenumbered1throughN,andMbikesnumbered1throughM.DeliverypersonxhasstrengthS[x],an
u011029779
·
2015-11-07 05:00
Algorithm
Hackathon
hackerrank
HackerRank
# Hexagonal Grid
原题地址 铺瓷砖的变种,做法也是类似 假设地板长下面这样,灰色的是无法填充的空洞,初始时可以把N块之外的地板填充成灰色的,便于边界处理 假设现在从后向前已经处理完了一部分,绿色的砖块代表已经遍历过了,蓝色虚线框代表已经计算完成的子问题 现在要遍历红色边框的地砖 只可能有两种铺法:  
·
2015-11-05 08:38
grid
HackerRank
# Wet Shark and Two Subsequences
原题地址 对于给定的两个约束条件,可以通过联立方程组直接解出子序列A的和和子序列B的和,即sum(A) = (r + s) / 2,sum(B) = (r - s) / 2,假设|A|=|B|=n 所以问题变成了,在一个数组中求长度为n且子序列和为sum(A)或sum(B)有多少个。 假设count(n, s)表示长度为n且子序列和为s有多少个,则要求的是count(n, s
·
2015-11-05 08:37
sequence
【
HackerRank
】Coin on the Table
题目链接:Coin on the Table 一开始想用DFS做的,做了好久都超时。 看了题解才明白要用动态规划。 设置一个三维数组dp,其中dp[i][j][k]表示在时间k到达(i,j)所需要做的最小改动,那么递推式如下: 图片来源:Editorial,其中当从周围的格子可以直接移动到(i,j)时,delta=0;否则,需要改变周围格子的方向符号,delta=1。 即k-1时刻在
·
2015-11-01 13:02
table
【
HackerRank
】Cut the tree
题目链接:Cut the tree 题解:题目要求求一条边,去掉这条边后得到的两棵树的节点和差的绝对值最小。 暴力求解会超时。 如果我们可以求出以每个节点为根的子树的节点之和,那么当我们去掉一条边(a,b)的时候,其中的一棵树必是以a或者b为根的子树,那么我们就可以知道生成的两棵树的节点之和了。所以,当我们得到以每个节点为根的子树节点和这个信息后(把这个信息存储在TreeNode的value
·
2015-11-01 13:01
tree
【
HackerRank
】Find the Median(Partition找到数组中位数)
In the Quicksort challenges, you sorted an entire array. Sometimes, you just need specific information about a list of numbers, and doing a full sort would be unnecessary. Can you figure out a way to
·
2015-11-01 13:01
partition
【
HackerRank
】Running Time of Quicksort
题目链接:Running Time of Quicksort Challenge In practice, how much faster is Quicksort (in-place) than Insertion Sort? Compare the running time of the two algorithms by counting how many swaps or sh
·
2015-11-01 13:00
Quicksort
【
HackerRank
】Game Of Rotation
题目连接:Game Of Rotation Mark is an undergraduate student and he is interested in rotation. A conveyor belt competition is going on in the town which Mark wants to win. In the competition, there's A con
·
2015-11-01 13:59
rank
【
HackerRank
】Sherlock and MiniMax
题目连接:Sherlock and MiniMax Watson gives Sherlock an array A1,A2...AN. He asks him to find an integer M between P and Q(both inclusive), such that, min {|Ai-M|,
·
2015-11-01 13:58
Lock
【
HackerRank
】Insertion Sort Advanced Analysis(归并排序求数列逆序数对)
Insertion Sort is a simple sorting technique which was covered in previous challenges. Sometimes, arrays may be too large for us to wait around for insertion sort to finish. Is there some other way we
·
2015-11-01 13:58
Advanced
【
HackerRank
】QuickSort(稳定快排,空间复杂度O(n))
QuickSort In the previous challenge, you wrote a partition method to split an array into 2 sub-arrays, one containing smaller elements and one containing larger elements. This means you 'sorted' ha
·
2015-11-01 13:57
Quicksort
【
HackerRank
】 Chocolate Feast
Little Bob loves chocolates, and goes to the store with $N money in his pocket. The price of each chocolate is $C. The store offers a discount: for every M wrappers he gives the store, he'll get one c
·
2015-11-01 13:56
rank
【
HackerRank
】 Game Of Thrones - I
King Robert has 7 kingdoms under his rule. He gets to know from a raven that the Dothraki are going to wage a war against him soon. But, he knows the Dothraki need to cross the narrow river to enter h
·
2015-11-01 13:56
rank
【
HackerRank
】Service Lane
Calvin is driving his favorite vehicle on the 101 freeway. He notices that the check engine light of his vehicle is on, and he wants to service it immediately to avoid any risks. Luckily, a serv
·
2015-11-01 13:55
service
Even Tree
Link: https://www.
hackerrank
.com/challenges/even-tree 1 def search(a,b): # 根据核心算法和题目要求要筛选边 2
·
2015-10-31 19:43
tree
HackerRank
# The Longest Common Subsequence
原题地址 LCD,经典动归,O(n^2)复杂度 因为要输出子序列,所以啰嗦一些 1 #include <cmath> 2 #include <cstdio> 3 #include <vector> 4 #include <iostream> 5 #include <algorithm&g
·
2015-10-31 16:25
sequence
HackerRank
# Bricks Game
原题地址 DP很简单,懒得压缩空间了,反正都能过 1 #include <cmath> 2 #include <cstdio> 3 #include <vector> 4 #include <iostream> 5 #include <algorithm> 6 #include
·
2015-10-31 16:24
rank
HackerRank
# Fibonacci Modified
原题地址 竟然64位都要爆,这是要大整数乘法的节奏吗?我才不要写大整数乘法呢,用Ruby干掉 代码: 1 # Enter your code here. Read input from STDIN. Print output to STDOUT 2 num = [0, 0] 3 num[0], num[1], n = readline.chomp.spl
·
2015-10-31 16:23
fibonacci
HackerRank
# Knapsack
原题地址 背包问题:容量为k,物品的体积和价值相等,求最大价值是多少 代码: 1 #include <cmath> 2 #include <cstdio> 3 #include <vector> 4 #include <iostream> 5 #include <algorithm>
·
2015-10-31 16:23
rank
HackerRank
# Stock Maximize
原题地址 不知道为什么要用动态规划做,明明是扫几遍就行了啊
HackerRank
上的题目特别喜欢long long类型啊,不用就爆。。
·
2015-10-31 16:22
rank
HackerRank
# Red John is Back
原题地址 简单动归+素数判定,没用筛法也能过 代码: 1 #include <cmath> 2 #include <cstdio> 3 #include <vector> 4 #include <iostream> 5 #include <algorithm> 6 #inclu
·
2015-10-31 16:21
rank
HackerRank
# Candies
原题地址 LeetCode上也有这道题,直接扫一遍就行了,连数组都不用开,感觉像是蕴含了某种动归的思想在里面,要不怎么是个动归题呢 代码: 1 #include <cmath> 2 #include <cstdio> 3 #include <vector> 4 #include <iostream>
·
2015-10-31 16:21
rank
HackerRank
# The Coin Change Problem
原题地址 背包问题,没啥好说的,记得用long long,否则会爆 代码: 1 #include <cmath> 2 #include <cstdio> 3 #include <vector> 4 #include <iostream> 5 #include <algorithm>
·
2015-10-31 16:20
change
Modified Kaprekar Numbers
Link: https://www.
hackerrank
.com/challenges/kaprekar-numbers 1 from __future__ import print_function
·
2015-10-31 14:55
number
上一页
1
2
3
4
5
6
7
8
下一页
按字母分类:
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
其他