Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c1ccbb8

Browse files
estudos
2 parents f81cd79 + b779ae6 commit c1ccbb8

File tree

34 files changed

+1438
-192
lines changed

34 files changed

+1438
-192
lines changed

‎PreffixSumSlidingWindow/.idea/misc.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎PreffixSumSlidingWindow/.idea/modules.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎PreffixSumSlidingWindow/.idea/workspace.xml

Lines changed: 293 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<module type="JAVA_MODULE" version="4">
3+
<component name="NewModuleRootManager" inherit-compiler-output="true">
4+
<exclude-output />
5+
<content url="file://$MODULE_DIR$">
6+
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
7+
</content>
8+
<orderEntry type="inheritedJdk" />
9+
<orderEntry type="sourceFolder" forTests="false" />
10+
</component>
11+
</module>

‎PreffixSumSlidingWindow/raw/links

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
sliding window algorithm
2+
http://www.geeksforgeeks.org/window-sliding-technique/
3+
http://www.geeksforgeeks.org/sliding-window-maximum-maximum-of-all-subarrays-of-size-k/
4+
https://www.nayuki.io/page/sliding-window-minimum-maximum-algorithm
5+
https://algorithmsandme.in/2014/03/15/heaps-sliding-window-algorithm/
6+
7+
8+
Problems
9+
https://www.hackerrank.com/contests/101hack51/challenges/charging-the-batteries/
10+
11+
prefix sums/sliding window
12+
https://discuss.leetcode.com/topic/87710/javascript-o-n-using-flexible-sliding-window-and-prefix-sums
13+
https://cs.stackexchange.com/questions/39529/efficient-way-to-calculate-sum-in-sliding-window
14+
https://cs.stackexchange.com/questions/64305/sliding-window-sum-greater-than-n-using-as-few-numbers-as-possible
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package problems;
2+
3+
public class SumOfSubset {
4+
5+
6+
public static int maxSumOfSubsetK(int [] set, int k) {
7+
int limit = set.length;
8+
int acc = 0;
9+
for (int i=0; i<k ; i++) {
10+
acc += set[i];
11+
}
12+
int partial = acc;
13+
for (int i = k; i < limit ; i++) {
14+
partial = partial + set[i] - set[i-k];
15+
acc = Math.max(acc, partial);
16+
17+
}
18+
return acc;
19+
}
20+
21+
public static void test1() {
22+
int [][] set = {
23+
{5 , 2 , -1 , 0 , 3}
24+
};
25+
System.out.println(maxSumOfSubsetK(set[0], 3));
26+
}
27+
28+
29+
30+
31+
public static void main(String[] args) {
32+
test1();
33+
}
34+
35+
}

‎PrincipleInclusionExclusion/.idea/.name

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎PrincipleInclusionExclusion/.idea/kotlinc.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎PrincipleInclusionExclusion/.idea/libraries/KotlinJavaRuntime.xml

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎PrincipleInclusionExclusion/.idea/misc.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /