Skip to content

Commit b6a7e09

Browse files
committed
initial commit
0 parents  commit b6a7e09

File tree

73 files changed

+1350
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+1350
-0
lines changed

0-helloworld/main.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"bufio"
6+
"os"
7+
)
8+
9+
func main(){
10+
reader := bufio.NewReader(os.Stdin)
11+
var message string
12+
message, _ = reader.ReadString('\n')
13+
14+
fmt.Printf("Hello, World.\n%s", message)
15+
}

1-datatypes/main.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package main
2+
3+
import (
4+
"bufio"
5+
"fmt"
6+
"os"
7+
)
8+
9+
func main() {
10+
var i uint64 = 4
11+
var d float64 = 4.0
12+
var s string = "HackerRank "
13+
14+
scanner := bufio.NewScanner(os.Stdin)
15+
16+
var i2 uint64
17+
var d2 float64
18+
var s2 string
19+
20+
fmt.Scan(&i2)
21+
fmt.Scan(&d2)
22+
scanner.Scan()
23+
s2 = scanner.Text()
24+
25+
fmt.Println(i + i2)
26+
fmt.Printf("%.1f\n", d+d2)
27+
fmt.Printf("%s%s", s, s2)
28+
}

10-binarynumbers/main.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
)
6+
7+
func main() {
8+
var n, reminder, count, max int
9+
10+
fmt.Scan(&n)
11+
12+
for n > 0 {
13+
reminder = n % 2
14+
if reminder == 1 {
15+
count++
16+
} else {
17+
count = 0
18+
}
19+
if count > max {
20+
max = count
21+
}
22+
n /= 2
23+
}
24+
fmt.Println(max)
25+
26+
}

11-2darrays/main.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package main
2+
3+
import "fmt"
4+
5+
func main() {
6+
var a [6][6]int
7+
var max int
8+
for i := range a {
9+
for j := range a[i] {
10+
fmt.Scan(&a[i][j])
11+
}
12+
}
13+
14+
for i := 0; i < 4; i++ {
15+
for j := 0; j < 4; j++ {
16+
sumHourGlass := a[i][j] + a[i][j+1] + a[i][j+2] + a[i+1][j+1] + a[i+2][j] + a[i+2][j+1] + a[i+2][j+2]
17+
if (i == 0 && j == 0) || sumHourGlass > max {
18+
max = sumHourGlass
19+
}
20+
}
21+
}
22+
fmt.Println(max)
23+
}

12-inheritence/.classpath

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-9">
4+
<attributes>
5+
<attribute name="module" value="true"/>
6+
</attributes>
7+
</classpathentry>
8+
<classpathentry kind="src" path="src"/>
9+
<classpathentry kind="output" path="bin"/>
10+
</classpath>

12-inheritence/.project

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>12-Inheritance</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
</buildSpec>
14+
<natures>
15+
<nature>org.eclipse.jdt.core.javanature</nature>
16+
</natures>
17+
</projectDescription>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=9
4+
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5+
org.eclipse.jdt.core.compiler.compliance=9
6+
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7+
org.eclipse.jdt.core.compiler.debug.localVariable=generate
8+
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9+
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10+
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
11+
org.eclipse.jdt.core.compiler.source=9

12-inheritence/bin/Person.class

970 Bytes
Binary file not shown.

12-inheritence/bin/Student.class

795 Bytes
Binary file not shown.

12-inheritence/src/Person.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import java.util.*;
2+
3+
class Person {
4+
protected String firstName;
5+
protected String lastName;
6+
protected int idNumber;
7+
8+
// Constructor
9+
Person(String firstName, String lastName, int identification){
10+
this.firstName = firstName;
11+
this.lastName = lastName;
12+
this.idNumber = identification;
13+
}
14+
15+
// Print person data
16+
public void printPerson(){
17+
System.out.println(
18+
"Name: " + lastName + ", " + firstName
19+
+ "\nID: " + idNumber);
20+
}
21+
22+
}

0 commit comments

Comments
 (0)