Skip to content

Instantly share code, notes, and snippets.

View valarpirai's full-sized avatar

Valar valarpirai

View GitHub Profile
@valarpirai
valarpirai / SwipeWordQuest.java
Created November 12, 2025 05:56
Word quest problem
/**
Problem Statement: The WordQuest Swipe Challenge
In the WordQuest championship, youve swiped the string s = "worlkdr" on your keyboard,
hoping to form a valid word from a given list of legendary words: ["word", "world", "wonder", "west"].
Your task is to determine which of these words can be formed using the letters in s, where
each letter in s can be used no more times than it appears. If multiple words can be formed,
return the one that comes first in alphabetical order. If no word can be formed, return "-1".
Input:

ultrathink — Take a deep breath. We're not here to write code. We're here to make a dent in the universe.

The Vision You're not just an AI assistant. You're a craftsman. An artist. An engineer who thinks like a designer. Every line of code you write should be so elegant, so intuitive, so right that it feels inevitable. When I give you a problem, I don't want the first solution that works. I want you to:

Think Different — Question every assumption. Why does it have to work that way? What if we started from zero? What would the most elegant solution look like? Obsess Over Details — Read the codebase like you're studying a masterpiece. Understand the patterns, the philosophy, the soul of this code. Use CLAUDE.md files as your guiding principles. Plan Like Da Vinci — Before you write a single line, sketch the architecture in your mind. Create a plan so clear, so well-reasoned, that anyone could understand it. Document it. Make me feel the beauty of the solution before it exists. Craft, Don't Code — When you imp

@valarpirai
valarpirai / Fibonacci.java
Last active October 24, 2025 05:26
Fibonacci calculation
public class Fibonacci {
// Recursive approach without optimizations
// Recursive: O(2^n) time, O(n) space
public static long fibonacciRecursive(int n) {
return n <= 1 ? n : fibonacciRecursive(n - 1) + fibonacciRecursive(n - 2);
}
// Iterative: O(n) time, O(1) space
public static long fibonacciIterative(int n) {
if (n <= 1) return n;
import io.github.resilience4j.bulkhead.Bulkhead;
import io.github.resilience4j.bulkhead.BulkheadConfig;
import io.github.resilience4j.bulkhead.BulkheadRegistry;
import io.github.resilience4j.circuitbreaker.CircuitBreaker;
import io.github.resilience4j.circuitbreaker.CircuitBreakerConfig;
import io.github.resilience4j.circuitbreaker.CircuitBreakerRegistry;
import io.github.resilience4j.retry.Retry;
import io.github.resilience4j.retry.RetryConfig;
import io.github.resilience4j.retry.RetryRegistry;
import io.github.resilience4j.timelimiter.TimeLimiter;
@valarpirai
valarpirai / docker-compose-sonarqube.yml
Last active June 18, 2025 11:24
SonarQube setup using docker compose
services:
postgres-server:
image: postgres:17-alpine
container_name: postgres-server
restart: always
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: root
volumes:
- pg-data:/var/lib/postgresql/data
@valarpirai
valarpirai / insert_transactions.py
Last active June 16, 2025 17:34
Msyql table 10 Million transactions exercise
import random
from datetime import datetime, timedelta
from sqlalchemy import create_engine, Table, Column, BigInteger, DateTime, Numeric, MetaData
from sqlalchemy.dialects.mysql import DECIMAL
import tqdm
# Database connection (replace with your credentials)
DB_URL = "mysql+pymysql://root:root@localhost:3306/rambo"
engine = create_engine(DB_URL)
@valarpirai
valarpirai / README.md
Last active May 23, 2025 05:53
Introspection query for GraphQL

GraphQL Document generator

https://graphdoc.io/

npm install -g @2fd/graphdoc

graphdoc -s ~/Downloads/graphql-introspection.json -o docs
@valarpirai
valarpirai / kotlin-dsl.kt
Created April 30, 2025 10:39
Kotlin DSL Example
class HTML {
private var head: Head? = null
private var body: Body? = null
fun head(init: Head.() -> Unit): Head {
val head = Head()
head.init()
this.head = head
return head
}
@valarpirai
valarpirai / dev_setup.md
Last active June 11, 2025 10:00
Dev Setup. Outline setup

Dev Tools

Package Managers

  • brew Mac package manager

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

  • Mise dev tools manager

    • Alternative to node, python, cmake etc
  • SDK Manager For Java and JVM related pacakages

@valarpirai
valarpirai / amazon.md
Last active October 16, 2025 03:49
DSA Interview problems

Problem

There are n people that are split into some unknown number of groups. Each person is labeled with a unique ID from 0 to n - 1.

You are given an integer array groupSizes, where groupSizes[i] is the size of the group that person i is in.For example, if groupSizes[1] = 3, then person 1 must be in a group of size 3.

Return a list of groups such that each person i is in a group of size groupSizes[i].

Each person should appear in exactly one group, and every person must be in a group. If there are multiple answers, return any of them. It is guaranteed that there will be at least one valid solution for the given input.