Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Greedy algo Activity program
import java.util.*; import java.lang.*; //In this code there is start and end times of some tasks are given. The aim is to determine maximum which all tasks can be completed //out of the given tasks class Rextester { public static void main(String args[]) { int start[] = {1,3,0,5,8,5}; int finish[] = {2,4,6,7,9,9}; int j=0; System.out.print(j + " "); for(int i=1;i<finish.length;i++){ if(start[i] >= finish[j]){ System.out.print(i + " "); j = i; } } } }
run
|
edit
|
history
|
help
0
Java Object Graph Dumper (iterative)
1*2-3+4
heeeeell
Vasanth Selvaraj
SecToHours
on_off
Variables&Types
log
Kochergina_5
1