Skip to content

Instantly share code, notes, and snippets.

View Aadithya-V's full-sized avatar
💭
What I cannot create, I do not understand sufficiently..

Aadithya V Aadithya-V

💭
What I cannot create, I do not understand sufficiently..
View GitHub Profile
@Aadithya-V
Aadithya-V / 0ProjectEuler.md
Last active May 14, 2023 18:09
ProjectEuler.net Problems 1-100

Solutions to problems 1 to 100 of projecteuler.net. Solutions to problems >100 are not permitted to be published publically.

Click this gist to view the folder of gists or go to https://gist.github.com/Aadithya-V/7d2bf0fa841d73b7b05bee0fb2398e5c

Mostly implemented in golang. Sharing the beautiful code :)

I recommend to not look at the solutions and try to solve on your own. It's fun!

These gists will be removed by the end of 2023.

@Aadithya-V
Aadithya-V / FloorMod.go
Last active May 13, 2023 11:07
FloorMod for Go
// For modulo not remainder:
// n mod m = n-⌊nm⌋.m
func FloorMod(n, m int) int {
res := n % m // remainder operator, strictly speaking: example-
//If -8 % 7 == 6, you're fine, but if it is -1, you'll need to adjust it by
//adding m to any negative results as below.
if res < 0 {
res += m
}
return res
@Aadithya-V
Aadithya-V / eqBinaryTree.go
Last active May 12, 2023 16:48
Equivalence Of Binary Trees- using concurrency of Go; Go Tour Exercise
package main
import (
"fmt"
"sync"
"golang.org/x/tour/tree"
)
// Walk walks the tree t sending all values
@Aadithya-V
Aadithya-V / webcrawler.go
Last active November 24, 2022 10:40
Go Tour Web Crawler Exercise Solution
package main
import (
"fmt"
"sync"
)
type Fetcher interface {
// Fetch returns the body of URL and
// a slice of URLs found on that page.
@Aadithya-V
Aadithya-V / rot13.go
Last active November 24, 2022 10:11
Go Tour rot13 Solution
package main
import (
"io"
"os"
"strings"
)
type rot13Reader struct {
r io.Reader
@Aadithya-V
Aadithya-V / wordcount.go
Created November 16, 2022 09:23
Go Tour Map Exercised
package main
import (
"golang.org/x/tour/wc"
"strings"
)
func WordCount(s string) map[string]int {
tokens := strings.Fields(s)
m := make(map[string]int)