Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Greedy algo Activity program
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
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; } } } }
[
+
]
Show input
Compilation time: 3.22 sec, absolute running time: 0.75 sec, cpu time: 0.35 sec, memory peak: 38 Mb, absolute service time: 4,07 sec
edit mode
|
history
|
discussion
0 1 3 4