Skip to content

Instantly share code, notes, and snippets.

View rxrav's full-sized avatar

rav rxrav

  • India
View GitHub Profile
package com.github.rxrav.java21bootcamp;
public class JavaRocks {
private final int times;
private boolean shouldPrintJava = true;
public JavaRocks(int times) {
this.times = times;
}
public synchronized void printJava(Runnable action) throws InterruptedException {
@rxrav
rxrav / wait_group.go
Last active March 11, 2020 05:39
Example of WaitGroup in Golang
package main
import (
"fmt"
"sync"
)
func sayHello() {
for i := 0; i <= 100; i++ {
fmt.Println("Hello", i)
@rxrav
rxrav / fibonacci_series_dynamic_programming.go
Last active March 8, 2020 12:04
Fibonacci series implementation using dynamic programming technique in Golang
package main
import "fmt"
var cache = make(map[int]int)
var dCounter int
func fibDyn(n int) int {
dCounter++
if _, ok := cache[n]; !ok {
@rxrav
rxrav / fibonacci_series_recursion.go
Last active March 8, 2020 12:03
Fibonacci series implementation using recursion technique in Golang
package main
import "fmt"
var rCounter int
func fibRec(i int) int {
rCounter++
if i == 1 {
return 0