Valid Anagram

Leetcode#242 Problem StatementExample 1Example 2Golang solutionOptimised codeOutput Problem Statement Given two strings s and t, return true if t is an  anagram of s, and false otherwise. Example 1 Input: s = "anagram", t = "nagaram" Output: true Example 2 Input: s = "rat",…

LRU Cache

Leetcode#146 Problem StatementLogic1. Understand the Problem Deeply2. Decompose the Problem3. Make Logic Explicit4. Think Iteratively5. Ask: "What Can Go Wrong?"6. Practice Modularization7. Visualize the Data Flow8. Iterate and RefactorGolang SolutionOutput…

Design an ATM Machine

Leetcode#2241 Design an ATM MachineGolang CodeOutput Design an ATM Machine There is an ATM machine that stores banknotes of 5 denominations: 20, 50, 100, 200, and 500 dollars. Initially the ATM is empty. The user can use the…

Design Authentication Manager

Leetcode#1797 Problem StatementGolang codeOutputOptimised code using HeapExplanation of Optimisations Problem Statement There is an authentication system that works with authentication tokens. For each session, the user will receive a new…

Design Browser History

Leetcode#1472 Problem StatementLogicGolang CodeOutputOptimised Solution Problem Statement You have a browser of one tab where you start on the homepage and you can visit another url, get back in the history number of steps or move forward…

Design Memory Allocator

Leetcode#2502 Problem StatementLogicGolang codeOutput Problem Statement You are given an integer n representing the size of a 0-indexed memory array. All memory units are initially free. You have a memory allocator with the following…

Design Twitter

Leetcode#355 Problem StatementLogicGolang SolutionOutput Twitter_Design Problem Statement Design a simplified version of Twitter where users can post tweets, follow/unfollow another user, and is able to see the 10 most recent tweets in…

Rest API Golang

Rest API GolangAPI URLHello World !How to runVerifyMarshalling Data structure to Json RepresentationBasic codeResponseWrong Content TypeCorrect JSON Content TypeUpdated CodeCorrected ResponseWith Updated json tagsXML encodingOutputClient Side Request HeaderOutputGo ModulesCommands usedgo.mod…

Golang Performance Benchmarking

Golang Performance BenchmarkingCommand Example Fibonacci numberBenchmarking ResultsExplanation1. Environment Information2. Package Information3. Benchmark Resultsa. BenchmarkFibo-8b. BenchmarkFiboOptimized-84. Thread Parallelism5. PASSSummary Golang Performance Benchmarking Command go test -bench=. Example Fibonacci number package main…