├── .gitignore ├── Algorithms ├── Array │ ├── 01 Kadane's Algorithm - Maximum Contiguous Subarray.ipynb │ ├── 02 Missing Number in array.ipynb │ ├── LPS_O(n) │ ├── fps_O(n) │ └── sudoku.c ├── Bit Manipulation │ ├── Clear i'th bit from right in a number.py │ ├── Count number of 1 in the binary representation of one.cpp │ ├── Count number of set or 1 bits.py │ ├── Get i'th bit from right in a number.py │ ├── Given a list of numbers where every numbers occurs twice except one number.py │ ├── Number is odd or even.py │ ├── Number of bits to change to a into b.py │ ├── Set i'th bit from right in a number.py │ └── XOR swapping.py ├── Data Structures │ └── SegmentTree.cpp ├── Dynamic Programming │ ├── Coin Change Problem.cpp │ ├── Fabonacci Number - Memoization.cpp │ ├── Fabonacci Number - Tabulation.cpp │ ├── LCS_DP.cpp │ └── README.md ├── Graph Algorithms │ ├── Dijkstra_priority_queue.cpp │ ├── KruskalMST.cpp │ ├── Sum of dependencies in a graph.ipynb │ └── prim.cpp ├── Mathematics │ ├── Base - fromDecimal.cpp │ ├── Base - fromDecimal2.cpp │ ├── Base - toDecimal.cpp │ ├── Base Change - STL.cpp │ ├── GCD - Euclid.cpp │ ├── GCD - Normal.cpp │ ├── LCM - Normal using GCD Euclid.cpp │ ├── Prime Number - Normal.cpp │ ├── Prime Number - Sieve of Eratosthenes.cpp │ ├── prime factorization.c │ └── sudoku.c ├── Sorting │ ├── BitonicSort.cpp │ ├── Bubble Sort-Optimised.cpp │ ├── Bubble Sort.cpp │ ├── Insertion Sort.cpp │ ├── Merge Sort.cpp │ ├── Selection sort.cpp │ ├── counting_sort.cpp │ ├── heapSort.cpp │ ├── quick_sort.py │ ├── radixs_sort.cpp │ ├── timsort.cpp │ └── topologicalSort.cpp └── String Manipulation │ ├── ShiftbyK.cpp │ └── partialpalindrome.c ├── Code Templates ├── 00008.cpp ├── Codeforces.cpp ├── Google APAC.cpp ├── Google.py └── Topcoder-SRM.cpp ├── Codechef problems ├── auglunchtime1.cpp └── septlunch1.cpp ├── Competitions ├── AtCoder │ └── AtCoder Beginner Contest 043 │ │ ├── Be Together.cpp │ │ ├── Children and Candies.cpp │ │ └── Unhappy Hacking.cpp ├── Codechef │ ├── ACMIND16 │ │ ├── Help Lost Robot.cpp │ │ ├── Robolympic Batons.cpp │ │ └── Watson and Digit Sums.cpp │ ├── APRIL17 │ │ └── Similar Dishes.py │ ├── AUG16 │ │ └── Chef and Chocolate.cpp │ ├── AUG17 │ │ ├── CHEFMOVR.py │ │ └── RAINBOWA.py │ ├── AUG19A │ │ └── MAXEXPR.cpp │ ├── COOK72 │ │ ├── Chef and Array.cpp │ │ └── Chef and Proportion.cpp │ ├── COOK73 │ │ └── Tweedle-Dee and Tweedle-Dum.cpp │ ├── COOK74 │ │ ├── Counting Strings.cpp │ │ ├── Lazy Jem.cpp │ │ └── The Lost Arithmetic Sequences.cpp │ ├── COOK75 │ │ └── Sherlock Counts Ways.cpp │ ├── COOK77 │ │ └── Chef and Subset.cpp │ ├── COOK85 │ │ ├── ELEVSTRS.py │ │ └── OBTTRNGL.py │ ├── FEB17 │ │ └── Chef and His Apartment Dues.cpp │ ├── JAN17 │ │ └── Cats and Dogs.cpp │ ├── KGP16MOS │ │ ├── Coal Mafia and Toll Tax.cpp │ │ └── Optimal Partition.cpp │ ├── LTIME39 │ │ └── Studying Alphabet.cpp │ ├── LTIME41 │ │ └── The Largest Bouquet.cpp │ ├── LTIME43 │ │ └── Superheroes and villains.cpp │ ├── LTIME44 │ │ └── Nothing in Common.cpp │ ├── LTIME50 │ │ ├── GCAC.py │ │ ├── LOSTMAX.py │ │ └── MAXOR.py │ ├── MARCH17 │ │ ├── Bear and Extra Number.cpp │ │ ├── Xenny and Alternating Tasks.cpp │ │ └── Xenny and Alternating Tasks.py │ ├── NOV17 │ │ ├── CLRL.py │ │ └── VILTRIBE.py │ ├── SEPT16 │ │ ├── Chef and digits of a number.cpp │ │ └── Faded Palindromes.cpp │ └── TSTIND16 │ │ ├── Mahasena.cpp │ │ └── Processing a string.cpp ├── Codeforces │ ├── Codecraft-17 and Codeforces Round #391 (Div. 1 + Div. 2, combined) │ │ ├── Bashs Big Day.cpp │ │ └── Gotta Catch Em All.cpp │ ├── Codeforces Beta Round #1 │ │ └── Theatre Square.cpp │ ├── Codeforces Beta Round #4 (Div. 2 Only) │ │ └── Watermelon.cpp │ ├── Codeforces Beta Round #47 │ │ └── Domino piling.cpp │ ├── Codeforces Beta Round #65 (Div. 2) │ │ └── Way Too Long Words.cpp │ ├── Codeforces Beta Round #77 (Div. 2 Only) │ │ └── Football.cpp │ ├── Codeforces Beta Round #89 (Div. 2) │ │ └── String Task.cpp │ ├── Codeforces Beta Round #96 (Div. 2) │ │ └── HQ9+.py │ ├── Codeforces Global Round 7 │ │ ├── A Bad Ugly Numbers.js │ │ └── test input.txt │ ├── Codeforces Round #143 (Div. 2) │ │ └── Team.cpp │ ├── Codeforces Round #173 (Div. 2) │ │ └── Bit++.cpp │ ├── Codeforces Round #348 (VK Cup 2016 Round 2, Div. 2 Edition) │ │ └── Little Artem and Presents.cpp │ ├── Codeforces Round #349 (Div. 2) │ │ └── Pouring Rain.cpp │ ├── Codeforces Round #352 (Div. 2) │ │ └── Summer Camp.cpp │ ├── Codeforces Round #354 (Div. 2) │ │ └── Nicholas and Permutation.cpp │ ├── Codeforces Round #355 (Div. 2) │ │ ├── Vanya and Fence.cpp │ │ └── Vanya and Food Processor.cpp │ ├── Codeforces Round #356 (Div. 2) │ │ └── Bear and Five Cards.cpp │ ├── Codeforces Round #357 (Div. 2) │ │ └── A Good Contest.cpp │ ├── Codeforces Round #358 (Div. 2) │ │ ├── Alyona and Mex.cpp │ │ └── Alyona and Numbers.cpp │ ├── Codeforces Round #359 (Div. 2) │ │ └── Free Ice Cream.cpp │ ├── Codeforces Round #360 (Div. 2) │ │ ├── Lovely Palindromes.cpp │ │ └── Opponents.cpp │ ├── Codeforces Round #362 (Div. 2) │ │ ├── Barnicle.cpp │ │ └── Pineapple Incident.cpp │ ├── Codeforces Round #363 (Div. 2) │ │ ├── Launch of Collider.cpp │ │ └── One Bomb.cpp │ ├── Codeforces Round #364 (Div. 2) │ │ ├── Cards.cpp │ │ ├── Cells Not Under Attack.cpp │ │ └── They Are Everywhere.cpp │ ├── Codeforces Round #365 (Div. 2) │ │ ├── Mishka and Game.cpp │ │ └── Mishka and Interesting sum.cpp │ ├── Codeforces Round #366 (Div. 2) │ │ ├── Hulk.cpp │ │ └── Spider Man.cpp │ ├── Codeforces Round #367 (Div. 2) │ │ ├── Beru-taxi.cpp │ │ ├── Hard problem.cpp │ │ ├── Interesting drink.cpp │ │ └── Vasiliy's Multiset.cpp │ ├── Codeforces Round #368 (Div. 2) │ │ └── Brain's Photos.cpp │ ├── Codeforces Round #369 (Div. 2) │ │ ├── Bus to Udayland.cpp │ │ └── Chris and Magic Square.cpp │ ├── Codeforces Round #370 (Div. 2) │ │ ├── Memory and Crow.cpp │ │ ├── Memory and De-Evolution.cpp │ │ └── Memory and Trident.cpp │ ├── Codeforces Round #371 (Div. 2) │ │ ├── Filya and Homework.cpp │ │ └── Meeting of Old Friends.cpp │ ├── Codeforces Round #372 (Div. 2) │ │ ├── Complete the Word.cpp │ │ └── Crazy Computer.cpp │ ├── Codeforces Round #376 (Div. 2) │ │ ├── Coupons and Discounts.cpp │ │ └── Night at the Museum.cpp │ ├── Codeforces Round #377 (Div. 2) │ │ └── Buy a Shovel.cpp │ ├── Codeforces Round #383 (Div. 2) │ │ └── Arpa’s hard exam and Mehrdad’s naive cheat.cpp │ ├── Codeforces Round #384 (Div. 2) │ │ ├── Vladik and flights.cpp │ │ └── Vladik and fractions.cpp │ ├── Codeforces Round #385 (Div. 2) │ │ └── Hongcow Learns the Cyclic Shift.cpp │ ├── Codeforces Round #386 (Div. 2) │ │ ├── Compote.cpp │ │ ├── Decoding.cpp │ │ └── Green and Black Tea.cpp │ ├── Codeforces Round #388 (Div. 2) │ │ └── Bachgold Problem.cpp │ ├── Codeforces Round #394 (Div. 2) │ │ ├── Dasha and Stairs │ │ └── Dasha and Stairs.cpp │ ├── Codeforces Round #395 (Div. 2) │ │ ├── Taymyr is calling you.cpp │ │ └── Timofey and cubes.cpp │ ├── Codeforces Round #396 (Div. 2) │ │ ├── Mahmoud and Longest Uncommon Subsequence.cpp │ │ └── Mahmoud and a Triangle.cpp │ ├── Codeforces Round #397 by Kaspersky Lab and Barcelona Bootcamp (Div. 1 + Div. 2 combined) │ │ ├── Code obfuscation.cpp │ │ ├── Neverending competitions.cpp │ │ └── Table Tennis Game 2.cpp │ ├── Codeforces Round #398 (Div. 2) │ │ └── Snacktower.cpp │ ├── Codeforces Round #401 (Div. 2) │ │ └── Shell Game.cpp │ ├── Codeforces Round #402 (Div. 2) │ │ ├── Dishonest Sellers.cpp │ │ ├── Pupils Redistribution.cpp │ │ ├── String Game.cpp │ │ └── Weird Rounding.cpp │ ├── Divide by Zero 2017 and Codeforces Round #399 (Div. 1 + Div. 2, combined) │ │ ├── Code For 1.cpp │ │ ├── Jon Snow and his Favourite Number.cpp │ │ └── Oath of the Nights Watch.cpp │ ├── Educational Codeforces Round 1 │ │ ├── Queries on a String.cpp │ │ └── Tricky Sum.cpp │ ├── Educational Codeforces Round 11 │ │ └── Seating On Bus.cpp │ ├── Educational Codeforces Round 14 │ │ ├── Fashion in Berland.cpp │ │ └── s-palindrome.cpp │ ├── Educational Codeforces Round 15 │ │ ├── Maximum Increase.cpp │ │ └── Powers of Two.cpp │ ├── Educational Codeforces Round 16 │ │ ├── King Moves.cpp │ │ └── Optimal Point on a Line.cpp │ ├── Good Bye 2016 │ │ ├── New Year and Hurry.cpp │ │ ├── New Year and North Pole.cpp │ │ └── New Year and Rating.cpp │ ├── ICM Technex 2017 and Codeforces Round #400 (Div. 1 + Div. 2, combined) │ │ ├── A Serial Killer.cpp │ │ └── Sherlock and his girlfriend.cpp │ └── VK Cup 2012 Qualification Round 1 │ │ └── Taxi.cpp ├── Doselect │ └── BookMyShow - Break the Deadlock │ │ ├── Manishonacci Numbers.py │ │ └── Snow Balls Attack.py ├── Facebook Hacker Cup │ └── 2017 Online Qualification Round │ │ ├── Problem 1 │ │ ├── Problem 1 │ │ ├── Problem 1.cpp │ │ ├── output.txt │ │ ├── progress_pie.txt │ │ ├── sample-input.txt │ │ └── sample-output.txt │ │ ├── Problem 2 │ │ ├── Problem 2 │ │ ├── Problem 2.cpp │ │ ├── lazy_loading.txt │ │ ├── output.txt │ │ ├── sample-input.txt │ │ └── sample-output.txt │ │ ├── Problem 3 │ │ └── Problem 3.cpp │ │ └── Solutions.zip ├── Google Code Jam │ ├── Qualification Round 2016 │ │ ├── Counting Sheep │ │ │ ├── A-large.in │ │ │ ├── A-small-attempt0.in │ │ │ ├── Minimum Scalar Product.cpp │ │ │ └── output.out │ │ └── Revenge of the Pancakes │ │ │ ├── B-large.in │ │ │ ├── B-small-attempt0.in │ │ │ ├── Revenge of the Pancakes.cpp │ │ │ └── output.out │ ├── Qualification Round 2017 │ │ ├── Problem 1 │ │ │ ├── A-large.in │ │ │ ├── A-small-attempt0.in │ │ │ ├── Problem 1.cpp │ │ │ ├── Problem 1.py │ │ │ ├── output.out │ │ │ ├── sample-input.in │ │ │ └── sample-output.out │ │ ├── Problem 2 │ │ │ ├── B-large.in │ │ │ ├── B-small-attempt0.in │ │ │ ├── B-small-attempt1.in │ │ │ ├── Problem 2.cpp │ │ │ ├── Problem 2.py │ │ │ ├── output.out │ │ │ ├── sample-input.in │ │ │ └── sample-output.out │ │ └── Problem 3 │ │ │ ├── C-small-1-attempt0.in │ │ │ ├── C-small-1-attempt1.in │ │ │ ├── Problem 3.cpp │ │ │ ├── Problem 3.py │ │ │ ├── output.out │ │ │ ├── sample-input.in │ │ │ ├── sample-output.out │ │ │ └── sample-output1.out │ ├── Qualification Round Africa 2010 │ │ ├── Reverse Words │ │ │ ├── B-large-practice.in │ │ │ ├── B-small-practice.in │ │ │ ├── Reverse Words.cpp │ │ │ ├── output.out │ │ │ └── sample-input.txt │ │ └── Store Credit │ │ │ ├── A-large-practice.in │ │ │ ├── A-small-practice.in │ │ │ ├── Store Credit.cpp │ │ │ ├── output.out │ │ │ └── sample-input.txt │ ├── Round 1A 2008 │ │ └── Minimum Scalar Product │ │ │ ├── A-large-practice.in │ │ │ ├── A-small-practice.in │ │ │ ├── Minimum Scalar Product.cpp │ │ │ ├── Problem 1.py │ │ │ ├── o1.txt │ │ │ ├── o2.txt │ │ │ └── output.out │ └── Round 1A 2016 │ │ └── The Last Word │ │ ├── A-large.in │ │ ├── A-small-attempt0.in │ │ ├── The Last Word.cpp │ │ └── output.out ├── Google Kickstart │ ├── 2017 Round A APAC │ │ └── Country Leader │ │ │ ├── A-large-practice.in │ │ │ ├── A-small-practice.in │ │ │ ├── Country Leader.cpp │ │ │ ├── output.out │ │ │ └── sample-input.txt │ ├── 2017 Round A │ │ ├── Problem 1 │ │ │ ├── A-large.in │ │ │ ├── A-small-attempt0.in │ │ │ ├── Problem 1 │ │ │ ├── Problem 1.cpp │ │ │ ├── output.out │ │ │ ├── output1.out │ │ │ └── sample-input.txt │ │ └── Problem 2 │ │ │ ├── B-small-attempt0.in │ │ │ ├── Problem 2 │ │ │ ├── Problem 2.cpp │ │ │ ├── output.out │ │ │ ├── output2.out │ │ │ └── sample-input.txt │ ├── 2017 Round B APAC │ │ ├── Problem 1 │ │ │ ├── A-large.in │ │ │ ├── A-small-attempt0.in │ │ │ ├── A-small-attempt1.in │ │ │ ├── Problem 1.cpp │ │ │ ├── output.out │ │ │ └── sample-input.txt │ │ └── Problem 2 │ │ │ ├── B-small-attempt0.in │ │ │ ├── B-small-attempt1.in │ │ │ ├── B-small-attempt2.in │ │ │ ├── Problem 2.cpp │ │ │ ├── output.out │ │ │ └── sample-input.txt │ ├── 2017 Round C APAC │ │ └── Problem 1 │ │ │ ├── Problem 1.cpp │ │ │ ├── output.out │ │ │ └── sample-input.txt │ ├── 2017 Round C │ │ └── Problem A │ │ │ ├── A.py │ │ │ ├── o1.txt │ │ │ └── sample-input.txt │ ├── 2017 Round D APAC │ │ ├── Problem 1 │ │ │ ├── A-large.in │ │ │ ├── A-small-attempt0.in │ │ │ ├── Problem 1.cpp │ │ │ ├── output.out │ │ │ └── sample-input.txt │ │ └── Problem 2 │ │ │ ├── B-small-attempt0.in │ │ │ ├── B-small-attempt1.in │ │ │ ├── B-small-attempt2.in │ │ │ ├── Problem 2.cpp │ │ │ ├── output.out │ │ │ └── sample-input.txt │ ├── 2017 Round D │ │ └── Problem A │ │ │ ├── A.py │ │ │ ├── output.txt │ │ │ └── sample-input.txt │ ├── 2017 Round E APAC │ │ ├── Problem 1 │ │ │ ├── A-large.in │ │ │ ├── A-small-attempt0.in │ │ │ ├── Problem 1.cpp │ │ │ ├── output.out │ │ │ └── sample-input.txt │ │ └── Problem 2 │ │ │ ├── B-small-attempt0.in │ │ │ ├── Problem 2.cpp │ │ │ ├── output.out │ │ │ └── sample-input.txt │ ├── 2017 Round E │ │ └── Problem A │ │ │ ├── A.py │ │ │ ├── output.txt │ │ │ └── sample-input.txt │ ├── 2017 Round F │ │ ├── Problem A │ │ │ ├── A-small-attempt0.in │ │ │ ├── A-small-attempt1.in │ │ │ ├── A-small-attempt2.in │ │ │ ├── A.py │ │ │ ├── output.txt │ │ │ ├── output0.txt │ │ │ ├── output1.txt │ │ │ ├── output2.txt │ │ │ └── sample-input.txt │ │ └── Problem D │ │ │ ├── D.py │ │ │ ├── output.txt │ │ │ └── sample-input.txt │ ├── 2018 Round A │ │ ├── A │ │ │ ├── A.py │ │ │ └── sample-input.txt │ │ ├── B │ │ │ ├── B.py │ │ │ └── sample-input.txt │ │ ├── C │ │ │ ├── C.py │ │ │ └── sample-input.txt │ │ └── D │ │ │ ├── D.py │ │ │ └── sample-input.txt │ ├── 2019 Round A │ │ ├── A │ │ │ ├── A.py │ │ │ ├── output-large.txt │ │ │ ├── sample-input.txt │ │ │ └── sample-output.txt │ │ ├── B │ │ │ ├── B.py │ │ │ └── sample-input.txt │ │ ├── C │ │ │ ├── C.py │ │ │ └── sample-input.txt │ │ └── D │ │ │ ├── D.py │ │ │ └── sample-input.txt │ └── README.md ├── HackerEarth │ ├── March Clash '17 │ │ ├── Ball Elimination.py │ │ └── Minimal Popcount.py │ └── September Circuits '17 │ │ └── Coin Game.py ├── README.md ├── Skillenza │ ├── Back-end Developer Recruitment drive │ │ └── Smartest Set.py │ ├── Blume Fellows Challenge │ │ ├── IntouchApp Recruitment Test │ │ │ ├── Merge Candidates.py │ │ │ └── circle.py │ │ ├── Quadrilateral Madness-new.cpp │ │ └── Quadrilateral Madness.cpp │ ├── Code Golf Challenge 1 │ │ ├── Fibonacci numbers 1.cpp │ │ └── Fibonacci numbers.cpp │ ├── Code Golf Sample test │ │ └── Sum of two numbers │ ├── Code Golf September Part 1 │ │ ├── Parity Check Python3.py │ │ └── Parity Check.py │ ├── DigitalIcean Competitive Programming Challenge │ │ └── Shortest Distance.cpp │ ├── DigitalOcean Campus Champ │ │ └── submission.md │ ├── Focuthon │ │ ├── Cubic Root.py │ │ ├── Integer Size Comparison.py │ │ ├── Quadrilateral Madness.cpp │ │ ├── Square Check.py │ │ ├── String Replacement.py │ │ ├── Tic Tac Toe.py │ │ ├── Trailing zeroes.py │ │ ├── V Shape.cpp │ │ └── V Shape.py │ ├── Freedom Jam │ │ └── Independence Day Cakes.py │ ├── Game of Thrones Online Coding Challenge │ │ └── We Do Not Sow.py │ ├── Need For Code_ August Awesomeness │ │ └── Chain it Up!.py │ └── September Stupendousness │ │ └── Tyrion fights Bran.py ├── TechGig │ └── Virtual Campus League 2017 │ │ └── Problem 1.py └── TopCoder │ ├── Humblefool Cup Round 1 │ └── 250.cpp │ ├── SRM 698 │ ├── 250.cpp │ └── 500.cpp │ ├── SRM 703 │ ├── 250.cpp │ └── 500.cpp │ └── TCO17 India Regionals Event │ ├── Submission.txt │ ├── Submission.zip │ └── main.py ├── Data Structures ├── 03 Stack │ └── Stack.cpp ├── 04 Linked List │ ├── 01 Singly Linked List.py │ └── README.md ├── 05 Trees │ └── 01 Introduction.ipynb ├── 06 Graph │ ├── 01 Graph.py │ ├── 02 Graph - BFS.py │ ├── 03 Graph - DFS.py │ └── README.md ├── 07 Disjoint Set │ └── DisjointSet.cpp ├── 08 Recursion │ └── nQueen.java └── 09 Hash Table │ └── hashtable.c ├── DynamicProgramming ├── BoardPath.java ├── CoinChange.java ├── EditDistance.java ├── EggDropping.java ├── Fibonacci.java ├── FordFulkerson.java ├── KadaneAlgorithm.java ├── Knapsack.java ├── README.md └── SubsetSum.java ├── Hackathons ├── Angular Attack │ └── Angular Attack 2017 - Invoice.pdf └── Devpost Amazon Alexa Skills Challenge │ ├── Bank Account Info.pdf │ └── CERT_AlexaAffidavitofEligibility_TeamAllocator.pdf ├── Hackerrank_python ├── 1.introduction │ ├── 01.Say _Hello, World!_ With Python.py │ ├── 02.Python If-Else.py │ ├── 03.Arithmetic Operators.py │ ├── 04.Python_ Division.py │ ├── 05.Loops.py │ ├── 06.Write a function.py │ └── 07.Print Function.py ├── 10.Built-Ins │ ├── 69.Zipped!.py │ ├── 70.Input().py │ ├── 71.Python Evaluation.py │ ├── 72.Athlete Sort.py │ ├── 73.Any or All.py │ └── 74.ginortS.py ├── 11.Classes │ ├── 75.Classes_ Dealing with Complex Numbers.py │ └── 76.Class 2 - Find the Torsional Angle.py ├── 12.Python Functionals │ ├── 77.Map and Lambda Function.py │ ├── 78.Validating Email Addresses With a Filter.py │ └── 79.Reduce Function.py ├── 13.Regex and Parsing │ ├── 80.Detect Floating Point Number.py │ ├── 81.Re.split().py │ ├── 82.Group(), Groups() & Groupdict().py │ ├── 83.Re.findall() & Re.finditer().py │ ├── 84.Re.start() & Re.end().py │ ├── 85.Regex Substitution.py │ ├── 86.Validating Roman Numerals.py │ ├── 87.Validating phone numbers.py │ ├── 88.Validating and Parsing Email Addresses.py │ ├── 89.Hex Color Code.py │ ├── 90.HTML Parser - Part 1.py │ ├── 91.HTML Parser - Part 2.py │ ├── 92.Detect HTML Tags, Attributes and Attribute Values.py │ ├── 93.Validating UID.py │ ├── 94.Validating Credit Card Numbers.py │ ├── 95.Validating Postal Codes.py │ └── 96.Matrix Script.py ├── 14.Closures and Decorators │ ├── 99.Standardize Mobile Number Using Decorators.py │ └── 991.Decorators 2 - Name Directory.py ├── 15.numpy │ ├── 1.Arrays.py │ ├── 10.Min and Max.py │ ├── 11.Mean, Var, and Std .py │ ├── 12.Dot and Cross.py │ ├── 13.Inner and Outer.py │ ├── 14.Polynomials.py │ ├── 15.Linear Algebra.py │ ├── 2.Shape and Reshape.py │ ├── 3.Transpose and Flatten.py │ ├── 4.Concatenate.py │ ├── 5.Zeros and Ones.py │ ├── 6.Eye and Identity.py │ ├── 7.Array Mathematics.py │ ├── 8.Floor, Ceil and Rint.py │ ├── 9.Sum and Prod.py │ └── README.md ├── 16.XML │ ├── 97.XML 1 - Find the Score.py │ └── 98.XML2 - Find the Maximum Depth.py ├── 17.debugging │ ├── 1.Words Score.py │ ├── 2.Default Arguments.py │ └── README.md ├── 2.basic data types │ ├── 08.List Comprehensions.py │ ├── 09.Find the Runner-Up Score!.py │ ├── 10.Nested Lists.py │ ├── 11.Finding the percentage.py │ ├── 12.Lists.py │ └── 13.Tuples.py ├── 3.string │ ├── 14.SWAp cASE.py │ ├── 15.String Split and join.py │ ├── 16.What's Your Name_.py │ ├── 17.Mutations.py │ ├── 18.Find a string.py │ ├── 19.String Validators.py │ ├── 20.Text Alignment.py │ ├── 21.Text Wrap.py │ ├── 22.Designer Door Mat.py │ ├── 23.String Formatting.py │ ├── 24.Alphabet Rangoli.py │ ├── 25.Capitalize!.py │ ├── 26.The Minion Game.py │ └── 27.Merge the Tools!.py ├── 4.sets │ ├── 28.Introduction to Sets.py │ ├── 29.No Idea!.py │ ├── 30.Symmetric Difference.py │ ├── 31.Set .add().py │ ├── 32.Set .discard(), .remove() & .pop().py │ ├── 33.Set .union() Operation.py │ ├── 34.Set .intersection() Operation.py │ ├── 35.Set .difference() Operation.py │ ├── 36.Set .symmetric_difference() Operation.py │ ├── 37.Set Mutations.py │ ├── 38.The Captain's Room.py │ ├── 39.Check Subset.py │ └── 40.Check Strict Superset.py ├── 5.math │ ├── 41.Polar Coordinates.py │ ├── 42.Find Angle MBC.py │ ├── 43.Mod Divmod.py │ ├── 44.Power - Mod Power.py │ ├── 45.Integers Come In All Sizes.py │ ├── 46.Triangle Quest.py │ └── 47.Triangle Quest 2.py ├── 6.itertools │ ├── 48.itertools.product().py │ ├── 49.itertools.permutations().py │ ├── 50.itertools.combinations().py │ ├── 51.itertools.combinations_with_replacement().py │ ├── 52.Compress the String!.py │ ├── 53.Iterables and Iterators.py │ └── 54.Maximize It!.py ├── 7.collections │ ├── 55.collections.Counter().py │ ├── 56.DefaultDict Tutorial.py │ ├── 57.Collections.namedtuple().py │ ├── 58.Collections.OrderedDict().py │ ├── 59.Word Order.py │ ├── 60.Collections.deque().py │ ├── 61.Company Logo.py │ └── 62.Piling Up!.py ├── 8.Date and time │ ├── 63.Calendar Module.py │ └── 64.Time Delta.py ├── 9.erros and exceptions │ ├── 65.Exceptions.py │ └── 66.Incorrect Regex.py └── README.md ├── Hiring Challenges ├── Amazon │ ├── Amazon All India Campus Programming Challenge │ │ ├── Q1.png │ │ └── Q2.png │ └── Amazon SDE Hiring Challenge │ │ └── README.md ├── Bosch Blockchain Developer Hiring │ └── Round 2 │ │ ├── README.md │ │ ├── contracts │ │ ├── Migrations.sol │ │ └── PropertyRegistration.sol │ │ ├── migrations │ │ ├── 1_initial_migration.js │ │ └── 2_deploy_contracts.js │ │ ├── package-lock.json │ │ ├── package.json │ │ ├── screenshots │ │ ├── 1.png │ │ ├── 2.png │ │ ├── 3.png │ │ └── 4.png │ │ ├── src │ │ ├── dapp │ │ │ ├── config.json │ │ │ ├── index.html │ │ │ ├── index.js │ │ │ └── react-app │ │ │ │ └── App.js │ │ └── server │ │ │ ├── config.json │ │ │ ├── index.js │ │ │ └── server.js │ │ ├── truffle.js │ │ ├── webpack.config.dapp.js │ │ └── webpack.config.server.js ├── Cleartrip Frontend Developer Hiring Challenge on Hackerearth │ └── README.md ├── Cogoport Frontend Developer Hiring Challenge on Hackerearth │ └── README.md ├── Google-Foobar │ └── 53-12-g8f9a222a-beta │ │ ├── Level 1 │ │ ├── 1.py │ │ └── README.md │ │ ├── Level 2 │ │ ├── 1.py │ │ ├── 2.py │ │ └── README.md │ │ ├── Level 3 │ │ ├── 1.py │ │ ├── 2.py │ │ ├── 3.py │ │ └── README.md │ │ └── README.md ├── HackerEarth │ ├── IndiaHacks 2017 - Artificial Intelligence │ │ └── README.md │ └── Simility Movies Listing │ │ └── README.md ├── Nvidia-Internshala │ ├── 3DVector.py │ └── FindFunctionDef.cpp14 ├── TCS │ └── CodevitaV6 │ │ └── Concatenating primes.py └── Twitter │ └── University 2018 - Test 7 │ ├── Q1.md │ ├── Q2.py │ └── Q3.py ├── Interviews ├── 11TechSquare │ ├── 11TechSquare Offer Letter Summer 2017(Manish Bisht).pdf │ └── edited_11TechSquare Offer Letter Summer 2017(Manish Bisht).pdf ├── Coursera │ └── Software Engineer - University Graduate 2018 │ │ ├── Range Minimum Query.py │ │ └── Royal Names.py ├── Glider-ai │ ├── Screen Shot 2019-06-26 at 11.13.20 PM.png │ └── Screen Shot 2019-06-26 at 11.13.25 PM.png ├── Google │ ├── Software Engineer University Graduate - Tokyo 2019 │ │ └── Round 1 - Online Challenge │ │ │ ├── Problem 1 │ │ │ ├── Not Available.txt │ │ │ ├── README.md │ │ │ ├── Solution.py │ │ │ ├── output.txt │ │ │ ├── sample-input.txt │ │ │ ├── sample-output.txt │ │ │ └── task1-test-input.txt │ │ │ ├── Problem 2 │ │ │ ├── Not Available.txt │ │ │ ├── README.md │ │ │ ├── Solution.py │ │ │ ├── output.txt │ │ │ ├── sample-input.txt │ │ │ ├── sample-output.txt │ │ │ └── task2-test-input.txt │ │ │ └── README.md │ ├── Software Engineering Intern - Germany Summer 2017 │ │ └── Round 1 - Development Task │ │ │ └── Development+Task.pdf │ └── Software Engineering Intern - Tokyo Summer 2017 │ │ └── Round 1 - Online Challenge │ │ ├── Problem 1 │ │ ├── After.py │ │ ├── Not Available.txt │ │ ├── Problem 1.cpp │ │ ├── README.md │ │ ├── o1.txt │ │ ├── output-after.txt │ │ ├── output.txt │ │ ├── sample-input.txt │ │ ├── sample-input2.txt │ │ └── task1-test-input.txt │ │ └── Problem 2 │ │ ├── After.py │ │ ├── Not Available.txt │ │ ├── Problem 1.cpp │ │ ├── README.md │ │ ├── output.txt │ │ ├── output2.txt │ │ ├── sample-input.txt │ │ ├── sample-output.txt │ │ └── task2-test-input.txt ├── Grab │ ├── Software Development Engineer 2019 v2 │ │ ├── Screen Shot 2019-07-06 at 9.01.08 PM.png │ │ ├── Screen Shot 2019-07-06 at 9.10.11 PM.png │ │ ├── Screen Shot 2019-07-06 at 9.48.30 PM.png │ │ └── Screen Shot 2019-07-06 at 9.57.02 PM.png │ └── Software Development Engineer 2019 │ │ ├── Screen Shot 2019-06-09 at 10.06.51 PM.png │ │ ├── Screen Shot 2019-06-09 at 10.27.48 PM.png │ │ ├── Screen Shot 2019-06-09 at 10.41.19 PM.png │ │ ├── Screen Shot 2019-06-09 at 10.44.31 PM.png │ │ ├── Screen Shot 2019-06-09 at 10.45.00 PM.png │ │ └── Screen Shot 2019-06-09 at 10.45.59 PM.png ├── Hackerearth │ ├── Summer Intern 2016 │ │ ├── HackerEarth Intership Snapshot.jpg │ │ ├── LICENSE │ │ ├── README.md │ │ ├── css │ │ │ └── style.css │ │ ├── images │ │ │ └── logo.png │ │ ├── index.html │ │ ├── js │ │ │ └── tasks.js │ │ └── snapshots │ │ │ ├── final.jpg │ │ │ └── sample.jpg │ └── Summer Intern 2017 │ │ ├── README.md │ │ ├── css │ │ └── style.css │ │ ├── downloads │ │ ├── file_explorer37a715d.zip │ │ └── file_explorer37a715d │ │ │ └── File Explorer │ │ │ ├── File Explorer-01.png │ │ │ ├── Layout │ │ │ ├── New-02.png │ │ │ ├── New-04.png │ │ │ ├── New-05.png │ │ │ ├── With grid-04.png │ │ │ ├── with grid-02.png │ │ │ └── with grid-05.png │ │ │ └── Resources │ │ │ ├── Folder.png │ │ │ ├── Logo.png │ │ │ ├── doc.png │ │ │ ├── image.png │ │ │ └── upload.png │ │ ├── images │ │ ├── Folder.png │ │ ├── doc.png │ │ ├── image.png │ │ ├── logo.png │ │ └── upload.png │ │ ├── index.html │ │ ├── js │ │ ├── jquery.min.js │ │ └── script.js │ │ ├── screenshots │ │ ├── p30.png │ │ └── p31.png │ │ └── submission.zip ├── Haptik │ └── Backend Developer │ │ ├── Backend Assignment.pdf │ │ ├── Task 1 │ │ ├── README.md │ │ ├── chats.txt │ │ └── solution.py │ │ ├── Task 2 │ │ ├── README-REACT.md │ │ ├── README.md │ │ ├── api │ │ │ ├── controllers │ │ │ │ ├── followerController.js │ │ │ │ ├── postController.js │ │ │ │ └── userController.js │ │ │ ├── index.js │ │ │ ├── modals │ │ │ │ ├── followerModal.js │ │ │ │ ├── postModal.js │ │ │ │ └── userModal.js │ │ │ └── routes │ │ │ │ ├── followerRoute.js │ │ │ │ ├── postRoute.js │ │ │ │ └── userRoute.js │ │ ├── dump │ │ │ └── twitter-clone │ │ │ │ ├── followers.bson │ │ │ │ ├── followers.metadata.json │ │ │ │ ├── posts.bson │ │ │ │ ├── posts.metadata.json │ │ │ │ ├── users.bson │ │ │ │ └── users.metadata.json │ │ ├── package-lock.json │ │ ├── package.json │ │ ├── public │ │ │ ├── favicon.ico │ │ │ ├── index.html │ │ │ └── manifest.json │ │ └── src │ │ │ ├── common │ │ │ └── Header.js │ │ │ ├── components │ │ │ ├── App.css │ │ │ ├── App.js │ │ │ ├── App.test.js │ │ │ └── pages │ │ │ │ ├── Index.js │ │ │ │ ├── Login.js │ │ │ │ ├── NewPost.js │ │ │ │ ├── SignUp.js │ │ │ │ ├── UserDetails.js │ │ │ │ └── UserHome.js │ │ │ ├── config.js │ │ │ ├── index.css │ │ │ ├── index.js │ │ │ ├── logo.svg │ │ │ └── serviceWorker.js │ │ └── Task 3 │ │ ├── README.md │ │ └── solution.py ├── README.md ├── Toptal │ ├── Screen Shot 2019-06-04 at 8.42.41 PM.png │ └── Task1.py └── Zalando │ └── Frontend Engineer - Distributed Commerce │ ├── Screen Shot 2019-08-06 at 11.18.37 PM.png │ ├── Screen Shot 2019-08-07 at 12.18.39 AM.png │ └── Screen Shot 2019-08-07 at 12.19.41 AM.png ├── LICENSE ├── NEW_PROBLEM ├── Practice ├── CodeWars │ └── 1-2kyu │ │ └── Insane Coloured Triangle.js ├── Codeforces │ ├── Alternating Subsequence-1343C.cpp │ ├── Beautiful Divisors-893B │ ├── DZY Loves Strings-447B │ ├── Increase and Copy-1426C.cpp │ ├── Minimum Triangulation-1140D.cpp │ ├── Perfect Team-1221C.cpp │ ├── Proper Nutrition-898B.cpp │ ├── Santa Claus and Candies-753A.cpp │ ├── Symmetric Matrix-1426B.cpp │ └── XORinacci-1208A ├── Coding Blocks │ ├── Competitive Warriors Challenge 1.0 │ │ ├── Advanced GCD.py │ │ ├── Alex Goes Shopping.py │ │ ├── Arrays-Binary Search.py │ │ ├── Binary To Decimal.py │ │ ├── Calculating Function.py │ │ ├── Chewbacca and Number.py │ │ ├── Choosing Numbers.py │ │ ├── Conversion(Any To Any).py │ │ ├── Count Set Bits.py │ │ ├── Count heads.py │ │ ├── Counting Sort.py │ │ ├── Deepak and Primes II.py │ │ ├── Deepak and Primes.py │ │ ├── Dice expectations - 1.py │ │ ├── Dice expectations - 2.py │ │ ├── Evaluating functions.py │ │ ├── GCD.py │ │ ├── Head Expectation.py │ │ ├── Help Ramu.py │ │ ├── Incredible Hulk.py │ │ ├── Interview Candidates.py │ │ ├── LCM.py │ │ ├── Light’s New Car.py │ │ ├── Pascal Triangle 1.py │ │ ├── Probability Coin - 1.py │ │ ├── Sanjay's New Job.py │ │ ├── Simple HCF.py │ │ ├── Simple Input.py │ │ ├── Simple factorial.py │ │ ├── String Sort.py │ │ ├── Success Expectation.py │ │ ├── Unique Numbers - II.py │ │ ├── Virat and Factorials.py │ │ └── Virat and nCr.py │ ├── Competitive Warriors Challenge 2.0 │ │ └── 3D Data Structure.py │ ├── Competitive Warriors Challenge 3.0 │ │ ├── Aggressive Cows.cpp │ │ ├── Aggressive Cows.py │ │ ├── Alpha Score - Updated.py │ │ ├── Are They Same.py │ │ ├── Even and odd divisors.py │ │ ├── Factorization Game.cpp │ │ ├── Factorization Game.py │ │ ├── Find It.py │ │ ├── Find Upper and Lower bound.py │ │ ├── HELP RAHUL TO SEARCH.py │ │ ├── Inversion Count.py │ │ ├── KTH ROOT.py │ │ ├── Lets Paint Up The Fences.cpp │ │ ├── Lets Paint Up The Fences.py │ │ ├── Match Them.cpp │ │ ├── Maximum Subarray Sum (Divide and Conquer).py │ │ ├── Multiples Again.py │ │ ├── Multiplicative Inverse.py │ │ ├── Murthal Parantha.cpp │ │ ├── Murthal Parantha.py │ │ ├── Number Of Divisors.cpp │ │ ├── Painter's Partition Problem.py │ │ ├── Pair of Roses.py │ │ ├── Play The Game.py │ │ ├── Read The Pages.py │ │ ├── Rearrange.py │ │ ├── Simple Enough.py │ │ ├── T-Prime.py │ │ ├── Uncommon.cpp │ │ ├── Uncommon.py │ │ ├── Vivek and Factors.cpp │ │ └── Vivek and Factors.py │ ├── Competitive Warriors Challenge 4.0 │ │ ├── COUNT PERMUTATIONS.py │ │ ├── Generate Parentheses.py │ │ ├── Recursion-Ascii Subsequences.py │ │ ├── Recursion-Subsequences.py │ │ ├── Recursion-Tower of Hanoi.py │ │ └── Tricky Permutations.py │ ├── Game Theory Hackathon │ │ └── GAME THEORY - 1.py │ └── cbdownload.py ├── Daily Coding Problem │ ├── 00001 │ │ ├── README.md │ │ └── solution.py │ ├── 00002 │ │ ├── README.md │ │ └── solution.py │ ├── 00003 │ │ └── README.md │ ├── 00004 │ │ └── README.md │ ├── 00005 │ │ └── README.md │ ├── 00006 │ │ └── README.md │ ├── 00007 │ │ └── README.md │ ├── 00008 │ │ ├── 00008.cpp │ │ └── README.md │ ├── 00218 │ │ └── README.md │ ├── 00219 │ │ └── README.md │ ├── 00220 │ │ └── README.md │ ├── 00221 │ │ └── README.md │ ├── 00222 │ │ └── README.md │ ├── 00223 │ │ └── README.md │ ├── 00224 │ │ └── README.md │ ├── 00225 │ │ └── README.md │ ├── 00226 │ │ └── README.md │ ├── 00227 │ │ └── README.md │ ├── 00228 │ │ └── README.md │ ├── 00229 │ │ └── README.md │ ├── 00230 │ │ └── README.md │ ├── 00231 │ │ └── README.md │ ├── 00232 │ │ └── README.md │ ├── 00233 │ │ ├── README.md │ │ └── solution.cpp │ ├── 00253 │ │ └── README.md │ ├── 00400 │ │ └── README.md │ ├── 00401 │ │ └── README.md │ ├── 00402 │ │ └── README.md │ ├── 00403 │ │ └── README.md │ ├── 00404 │ │ └── README.md │ ├── 00405 │ │ └── README.md │ ├── 00406 │ │ └── README.md │ ├── 00407 │ │ └── README.md │ ├── 00408 │ │ └── README.md │ ├── 00409 │ │ └── README.md │ ├── 00410 │ │ └── README.md │ ├── 00411 │ │ └── README.md │ ├── 00412 │ │ └── README.md │ ├── 00413 │ │ └── README.md │ ├── 00414 │ │ └── README.md │ ├── 00415 │ │ └── README.md │ ├── 00416 │ │ └── README.md │ ├── 00417 │ │ └── README.md │ ├── 00418 │ │ └── README.md │ ├── 00419 │ │ └── README.md │ ├── 00420 │ │ └── README.md │ ├── 00421 │ │ └── README.md │ ├── 00422 │ │ └── README.md │ ├── 00423 │ │ └── README.md │ ├── 00424 │ │ └── README.md │ ├── 00425 │ │ └── README.md │ ├── 00426 │ │ └── README.md │ ├── 00427 │ │ └── README.md │ ├── 00428 │ │ └── README.md │ ├── 00429 │ │ └── README.md │ ├── 00430 │ │ └── README.md │ ├── 00431 │ │ └── README.md │ ├── 00432 │ │ └── README.md │ ├── 00433 │ │ └── README.md │ ├── 00434 │ │ └── README.md │ ├── 00435 │ │ └── README.md │ ├── 00436 │ │ └── README.md │ ├── 00437 │ │ └── README.md │ ├── 00438 │ │ └── README.md │ ├── 00439 │ │ └── README.md │ ├── 00440 │ │ └── README.md │ ├── 00441 │ │ └── README.md │ ├── 00442 │ │ └── README.md │ ├── 00443 │ │ └── README.md │ ├── 00444 │ │ └── README.md │ ├── 00445 │ │ └── README.md │ ├── 00446 │ │ └── README.md │ ├── 00447 │ │ └── README.md │ ├── 00448 │ │ └── README.md │ ├── 00449 │ │ └── README.md │ ├── 00450 │ │ └── README.md │ ├── 00451 │ │ └── README.md │ ├── 00452 │ │ └── README.md │ ├── 00453 │ │ └── README.md │ ├── 00454 │ │ └── README.md │ ├── 00455 │ │ └── README.md │ ├── 00456 │ │ └── README.md │ ├── 00457 │ │ └── README.md │ ├── 00458 │ │ └── README.md │ ├── 00459 │ │ └── README.md │ ├── 00460 │ │ └── README.md │ ├── 00461 │ │ └── README.md │ ├── 00462 │ │ └── README.md │ ├── 00463 │ │ └── README.md │ ├── 00464 │ │ └── README.md │ ├── 00465 │ │ └── README.md │ ├── 00466 │ │ └── README.md │ ├── 00467 │ │ └── README.md │ ├── 00468 │ │ └── README.md │ ├── 00469 │ │ └── README.md │ ├── 00470 │ │ └── README.md │ ├── 00471 │ │ └── README.md │ ├── 00472 │ │ └── README.md │ ├── 00473 │ │ └── README.md │ ├── 00474 │ │ └── README.md │ ├── 00475 │ │ └── README.md │ ├── 00476 │ │ └── README.md │ ├── 00477 │ │ └── README.md │ ├── 00478 │ │ └── README.md │ ├── 00479 │ │ └── README.md │ ├── 00480 │ │ └── README.md │ ├── 00481 │ │ └── README.md │ ├── 00482 │ │ └── README.md │ ├── 00483 │ │ └── README.md │ ├── 00484 │ │ └── README.md │ ├── 00485 │ │ └── README.md │ ├── 00486 │ │ └── README.md │ ├── 00487 │ │ └── README.md │ ├── 00488 │ │ └── README.md │ ├── 00489 │ │ └── README.md │ ├── 00490 │ │ └── README.md │ ├── 00491 │ │ └── README.md │ ├── 00492 │ │ └── README.md │ ├── 00493 │ │ └── README.md │ ├── 00494 │ │ └── README.md │ ├── 00495 │ │ └── README.md │ ├── 00496 │ │ └── README.md │ ├── 00497 │ │ └── README.md │ ├── 00498 │ │ └── README.md │ ├── 00499 │ │ └── README.md │ ├── 00500 │ │ └── README.md │ ├── 00501 │ │ └── README.md │ ├── 00502 │ │ └── README.md │ ├── 00503 │ │ └── README.md │ ├── 00504 │ │ └── README.md │ ├── 00505 │ │ └── README.md │ ├── 00506 │ │ └── README.md │ ├── 00507 │ │ └── README.md │ ├── 00508 │ │ └── README.md │ ├── 00509 │ │ └── README.md │ ├── 00510 │ │ └── README.md │ ├── 00511 │ │ └── README.md │ ├── 00512 │ │ └── README.md │ ├── 00513 │ │ └── README.md │ ├── 00514 │ │ └── README.md │ ├── 00515 │ │ └── README.md │ ├── 00516 │ │ └── README.md │ ├── 00517 │ │ └── README.md │ ├── 00518 │ │ └── README.md │ ├── 00519 │ │ └── README.md │ ├── 00520 │ │ └── README.md │ ├── 00521 │ │ └── README.md │ ├── 00522 │ │ └── README.md │ ├── 00523 │ │ └── README.md │ ├── 00524 │ │ └── README.md │ └── 00525 │ │ └── README.md ├── Google │ └── README.md ├── LeetCode │ ├── 1 Two Sum.py │ ├── 20. Valid Parentheses.py │ ├── 2020 April LeetCoding Challenge │ │ ├── 01 - Single Number.js │ │ ├── 02 - Happy Number.js │ │ ├── 03 - Maximum Subarray.js │ │ ├── 04 - Move Zeroes.js │ │ ├── 05 - Best Time to Buy and Sell Stock II.js │ │ ├── 06 - Group Anagrams.js │ │ ├── 07 - Counting Elements.js │ │ ├── 08 - Middle of the Linked List.js │ │ ├── 09 - Backspace String Compare.js │ │ ├── 10 - Min Stack.js │ │ ├── 11 - Diameter of Binary Tree.js │ │ ├── 12 - Last Stone Weight.js │ │ ├── 13 - Contiguous Array.js │ │ ├── 14 - Perform String Shifts.js │ │ ├── 15 - Product of Array Except Self.js │ │ ├── 16 - Valid Parenthesis String.js │ │ ├── 17 - Number of Islands.js │ │ ├── 18 - Minimum Path Sum.js │ │ ├── 19 - Search in Rotated Sorted Array.js │ │ ├── 20 - Construct Binary Search Tree from Preorder Traversal.js │ │ ├── 21 - Leftmost Column with at Least a One.js │ │ ├── 22 - Subarray Sum Equals K.js │ │ ├── 23 - Bitwise AND of Numbers Range.js │ │ ├── 24 - LRU Cache.js │ │ ├── 25 - Jump Game.js │ │ ├── 26 - Longest Common Subsequence.js │ │ ├── 27 - Maximal Square.js │ │ ├── 28 - First Unique Number.js │ │ ├── 29 - Binary Tree Maximum Path Sum.js │ │ └── 30 - Check If a String Is a Valid Sequence from Root to Leaves Path in a Binary Tree.js │ └── 2020 May LeetCoding Challenge │ │ ├── 01 - First Bad Version.js │ │ ├── 02 - Jewels and Stones.js │ │ ├── 03 - Ransom Note.js │ │ ├── 04 - Number Complement.js │ │ ├── 05 - First Unique Character in a String.js │ │ ├── 06 - Majority Element.js │ │ ├── 07 - Cousins in Binary Tree.js │ │ ├── 08 - Check If It Is a Straight Line.js │ │ ├── 09 - Valid Perfect Square.js │ │ ├── 10 - Find the Town Judge.js │ │ ├── 11 - Flood Fill.js │ │ ├── 12 - Single Element in a Sorted Array.js │ │ ├── 13 - Remove K Digits.js │ │ ├── 14 - Implement Trie (Prefix Tree).js │ │ ├── 15 - Maximum Sum Circular Subarray.js │ │ ├── 16 - Odd Even Linked List.js │ │ ├── 17 - Find All Anagrams in a String.js │ │ ├── 18 - Permutation in String.js │ │ ├── 19 - Online Stock Span.js │ │ ├── 20 - Kth Smallest Element in a BST.js │ │ ├── 21 - Count Square Submatrices with All Ones.js │ │ ├── 22 - Sort Characters By Frequency.js │ │ ├── 23 - Interval List Intersections.js │ │ └── 24 - Construct Binary Search Tree from Preorder Traversal.js ├── Spoj │ ├── COINS.cpp │ ├── ESYRCRTN - Easy Recursion.cpp │ ├── GSS1 - Can you answer these queries.cpp │ ├── JULKA.cpp │ ├── JULKA.py │ └── Solved Classical Problems │ │ ├── AE00.cpp │ │ ├── CANDY.cpp │ │ ├── CRZYSMKR.cpp │ │ ├── FASHION.cpp │ │ ├── FCTRL2.cpp │ │ ├── LASTDIG.cpp │ │ ├── NSTEPS.cpp │ │ ├── ONP.cpp │ │ ├── SAMER08F.cpp │ │ └── TOANDFRO.cpp └── UriOnlineJudge │ ├── question1021.py │ ├── question1035.py │ ├── question1036.py │ ├── question1037.py │ ├── question1038.py │ ├── question1040.py │ ├── question1041.py │ ├── question1042.py │ ├── question1043.py │ ├── question1044.py │ ├── question1045.py │ ├── question1048.py │ ├── question1049.py │ ├── question1050.py │ └── question1051.py ├── README.md └── Resources ├── Action_Verbs_Others.txt ├── Action_Verbs_POR.txt ├── Action_Verbs_Projects.txt ├── Antti Laaksonen - Guide to Competitive Programming.pdf ├── Bjarne Stroustrup - A Tour of C++.pdf ├── Brian W. Kernighan, Dennis M. Ritchie - The C Programming Language.pdf ├── Cpp_reference.pdf ├── Cracking-the-Coding-Interview-4ed.pdf ├── Document from Od ├── Game Theory - Thomas S. Ferguson.pdf ├── How to Prepare Yourself for an Interview with Google.pdf ├── Joseph H. Silverman - A Friendly Introduction to Number Theory.pdf ├── Ronald L. Graham, Donald E. Knuth, Oren Patashnik - Concrete Mathematics.pdf ├── STL Quick Reference 1.29.pdf ├── Steven Halim, Felix Halim - Competitive Programming 3.pdf ├── Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, Clifford Stein - Introduction to Algorithms.pdf ├── atlassian_git_cheatsheet.pdf ├── books ├── Competitive Programmer’s Handbook.pdf ├── Competitive Programming 1.pdf ├── Competitive Programming 3.pdf ├── Michael T. Goodrich, Roberto Tamassia, Michael H. Goldwasser-Data Structures and Algorithms in Python-Wiley (2013).pdf ├── The Four Pillars of Geometry.pdf └── The Hitchhiker’s Guide to_the Programming Contests.pdf ├── crackingthefacebookcodinginterview-oct2014-141028192813-conversion-gate02.pptx └── google.pdf /.gitignore: -------------------------------------------------------------------------------- 1 | #CodeBlocks .exe and .o files 2 | *.o 3 | *.exe 4 | .idea 5 | .DS_Store 6 | 7 | #Jupyter Notebook checkpoints 8 | .ipynb_checkpoints 9 | -------------------------------------------------------------------------------- /Algorithms/Bit Manipulation/Clear i'th bit from right in a number.py: -------------------------------------------------------------------------------- 1 | def answer(n, i): 2 | return n & ~(1 << i) -------------------------------------------------------------------------------- /Algorithms/Bit Manipulation/Count number of 1 in the binary representation of one.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | long long int countOnes(long long int n){ 4 | long long int c=0; 5 | while(n>0){ 6 | n = n & (n-1); 7 | c++; 8 | } 9 | return c; 10 | } 11 | int main() 12 | { 13 | for(long long int i=1;i<=10;i++){ 14 | long long int a = rand() % 100; 15 | cout< 0: 5 | ans += (n & 1) 6 | n >>= 1 7 | return ans 8 | 9 | 10 | # O(number of set bits) 11 | def optimised(n): 12 | ans = 0 13 | while n > 0: 14 | n &= n - 1 15 | ans += 1 16 | return ans 17 | -------------------------------------------------------------------------------- /Algorithms/Bit Manipulation/Get i'th bit from right in a number.py: -------------------------------------------------------------------------------- 1 | def answer(n, i): 2 | return 0 if n & (1 << i) == 0 else 1 3 | -------------------------------------------------------------------------------- /Algorithms/Bit Manipulation/Given a list of numbers where every numbers occurs twice except one number.py: -------------------------------------------------------------------------------- 1 | def answer(numbers): 2 | ans = numbers[0] 3 | for i in numbers[1:]: 4 | ans ^= i 5 | return ans 6 | -------------------------------------------------------------------------------- /Algorithms/Bit Manipulation/Number is odd or even.py: -------------------------------------------------------------------------------- 1 | def answer(n): 2 | if n & 1: 3 | return "Odd" 4 | else: 5 | return "Even" 6 | -------------------------------------------------------------------------------- /Algorithms/Bit Manipulation/Number of bits to change to a into b.py: -------------------------------------------------------------------------------- 1 | def countOnes(n): 2 | ans = 0 3 | while n > 0: 4 | n &= n - 1 5 | ans += 1 6 | return ans 7 | 8 | 9 | def answer(a, b): 10 | return countOnes(a ^ b) 11 | -------------------------------------------------------------------------------- /Algorithms/Bit Manipulation/Set i'th bit from right in a number.py: -------------------------------------------------------------------------------- 1 | def answer(n, i): 2 | return n | 1 << i 3 | -------------------------------------------------------------------------------- /Algorithms/Bit Manipulation/XOR swapping.py: -------------------------------------------------------------------------------- 1 | def answer(a, b): 2 | a ^= b 3 | b ^= a 4 | a ^= b 5 | return a, b 6 | -------------------------------------------------------------------------------- /Algorithms/Mathematics/Base Change - STL.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() 4 | { 5 | for(long long int i=0;i<100;i++){ 6 | long long int a = rand() % 100; 7 | cout< 2 | using namespace std; 3 | 4 | long long int GCD(long long int a, long long int b){ 5 | for(long long int i=min(a,b);i>=1;i--) 6 | if(a%i==0 && b%i==0) 7 | return i; 8 | } 9 | int main() 10 | { 11 | for(long long int i=0;i<100;i++){ 12 | long long int a = rand() % 100; 13 | long long int b = rand() % 100; 14 | cout< 2 | using namespace std; 3 | string shiftByK(string s, long long int k){ 4 | string temp = s; 5 | long long int len = s.length(); 6 | for(long long int i=0;i 2 | using namespace std; 3 | int main() { 4 | freopen("A-large-practice.in", "r", stdin); 5 | freopen("output.out", "w", stdout); 6 | long long int t, n, i, j, ans; 7 | cin>>t; 8 | for(i=0;i 2 | using namespace std; 3 | class Initials { 4 | public : string getInitials(string s){ 5 | string c=""; 6 | c.push_back(s[0]); 7 | for(int i=1;i 2 | using namespace std; 3 | long long int n; 4 | int main() 5 | { 6 | cin>>n; 7 | cout<<(n*(n+1))/2< 2 | using namespace std; 3 | long long int t, n, i, j, d; 4 | int main() 5 | { 6 | cin>>t; 7 | for(i=0;i>d; 9 | d=(d%9)+1; 10 | cout< 1: 10 | print "similar" 11 | else: 12 | print "dissimilar" 13 | -------------------------------------------------------------------------------- /Competitions/Codechef/COOK74/Counting Strings.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | long long int i, ans; 4 | string s; 5 | int main() 6 | { 7 | cin>>s; 8 | sort(s.begin(), s.end()); 9 | reverse(s.begin(), s.end()); 10 | for(i=1;i 2 | using namespace std; 3 | long long int n, k, i, j, temp, ans; 4 | set v; 5 | int main() 6 | { 7 | cin>>n>>k; 8 | ans=1; 9 | for(i=0;i>temp; 11 | v.insert(temp); 12 | } 13 | temp=v.size(); 14 | for(i=0;i (data[0] * 2) / data[2]: 5 | print "Elevator" 6 | else: 7 | print "Stairs" 8 | -------------------------------------------------------------------------------- /Competitions/Codechef/COOK85/OBTTRNGL.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Competitions/Codechef/COOK85/OBTTRNGL.py -------------------------------------------------------------------------------- /Competitions/Codechef/LTIME50/GCAC.py: -------------------------------------------------------------------------------- 1 | t = int(raw_input().strip()) 2 | for i in xrange(t): 3 | data = [int(j) for j in raw_input().strip().split()] 4 | n = data[0] 5 | m = data[1] 6 | minSalary = [int(j) for j in raw_input().strip().split()] 7 | company = [] 8 | for j in xrange(m): 9 | data = [int(k) for k in raw_input().strip().split()] 10 | company.append(data) 11 | offer = [] 12 | for j in xrange(n): 13 | offer.append(int(raw_input().strip())) -------------------------------------------------------------------------------- /Competitions/Codechef/LTIME50/LOSTMAX.py: -------------------------------------------------------------------------------- 1 | t = int(raw_input().strip()) 2 | for i in xrange(t): 3 | data = [int(j) for j in raw_input().strip().split()] 4 | data.remove(len(data)-1) 5 | print max(data) -------------------------------------------------------------------------------- /Competitions/Codechef/LTIME50/MAXOR.py: -------------------------------------------------------------------------------- 1 | t = int(raw_input().strip()) 2 | for i in xrange(t): 3 | n = int(raw_input().strip()) 4 | data = [int(j) for j in raw_input().strip().split()] 5 | ans = 0 6 | for j in xrange(n - 1): 7 | for k in xrange(j + 1, n): 8 | if data[j] | data[k] <= max(data[j], data[k]): 9 | ans += 1 10 | print ans 11 | -------------------------------------------------------------------------------- /Competitions/Codechef/MARCH17/Xenny and Alternating Tasks.py: -------------------------------------------------------------------------------- 1 | t = int(raw_input()) 2 | for i in xrange(0, t): 3 | n = int(raw_input()) 4 | x = [int(j) for j in raw_input().split(" ")] 5 | x.sort() 6 | for j in xrange(1, n-1): 7 | if x[j-1]+1 != x[j] and x[j-1]+2 != x[j+1]: 8 | print x[j-1] 9 | break 10 | elif x[j-1]+1 != x[j] and x[j]+1 != x[j+1]: 11 | print x[j] 12 | break 13 | elif x[j-1]+2 != x[j+1] and x[j]+1 != x[j+1]: 14 | print x[j+1] 15 | break 16 | -------------------------------------------------------------------------------- /Competitions/Codechef/TSTIND16/Processing a string.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | long long int t, i, j, sum; 4 | string s; 5 | int main() 6 | { 7 | cin>>t; 8 | for(i=0;i>s; 11 | for(j=0;j48 && s[j]<58){ 13 | sum=sum+s[j]-48; 14 | } 15 | } 16 | cout< 2 | using namespace std; 3 | int main() 4 | { 5 | long long int a, b, c; 6 | cin>>a>>b>>c; 7 | cout<<((a+c-1)/c)*((b+c-1)/c)< 2 | using namespace std; 3 | int main() 4 | { 5 | long long int n; 6 | cin>>n; 7 | if(n%2==0 && n>3){ 8 | cout<<"YES"< 2 | using namespace std; 3 | int main() 4 | { 5 | long long int n, m; 6 | cin>>n>>m; 7 | cout<<(n*m)/2< 2 | using namespace std; 3 | int main() 4 | { 5 | long long int t, i; 6 | string s; 7 | cin>>t; 8 | for(i=0;i>s; 10 | if(s.length()>10){ 11 | cout< 2 | using namespace std; 3 | int main() 4 | { 5 | long long int n, a, b, c, ans, i; 6 | cin>>n; 7 | ans = 0; 8 | for(i = 0; i < n; i++){ 9 | cin>>a>>b>>c; 10 | if(a + b + c >= 2){ 11 | ans++; 12 | } 13 | } 14 | cout< 2 | using namespace std; 3 | int main() 4 | { 5 | long long int n, i, ans; 6 | string s; 7 | cin>>n; 8 | ans = 0; 9 | for(i = 0; i < n; i++){ 10 | cin>>s; 11 | if(s[1]=='+'){ 12 | ans++; 13 | } 14 | else { 15 | ans--; 16 | } 17 | } 18 | cout< 2 | #include 3 | using namespace std; 4 | long long int n, c; 5 | int main() 6 | { 7 | cin>>n; 8 | c=2*(n/3); 9 | if(n%3!=0) 10 | { 11 | c++; 12 | } 13 | cout< 2 | #include 3 | using namespace std; 4 | long long int n, h, i, s, temp; 5 | int main() 6 | { 7 | cin>>n>>h; 8 | s=0; 9 | for(i=0; i>temp; 12 | if(temp<=h) 13 | { 14 | s++; 15 | } 16 | else 17 | { 18 | s=s+2; 19 | } 20 | } 21 | cout< 2 | #include 3 | using namespace std; 4 | long long int n, a, b, i, c; 5 | string s; 6 | int main() 7 | { 8 | cin>>n; 9 | c=0; 10 | for(i=0;i>s>>a>>b; 12 | if(b>a && a>=2400){ 13 | c++; 14 | } 15 | } 16 | if(c>0){ 17 | cout<<"YES"< 2 | using namespace std; 3 | long long int n, i, a[100000], temp; 4 | int main() 5 | { 6 | cin>>n; 7 | for(i=0;i>a[i]; 9 | } 10 | sort(a, a+n); 11 | temp=1; 12 | for(i=0;i=temp){ 14 | temp++; 15 | } 16 | } 17 | cout< 2 | #include 3 | using namespace std; 4 | long long int n, m, i, j, c, temp; 5 | int main() 6 | { 7 | cin>>n>>m; 8 | for(i=1;i<=n;i++){ 9 | temp=m+i; 10 | c=c+(temp/5); 11 | if(i>=5){ 12 | c=c-(i/5); 13 | } 14 | //cout< 2 | #include 3 | using namespace std; 4 | string s; 5 | int main() 6 | { 7 | cin>>s; 8 | cout< 2 | #include 3 | #include 4 | using namespace std; 5 | long long int i, a, b, len, temp; 6 | double dd, d; 7 | string s; 8 | int main() 9 | { 10 | cin>>s; 11 | temp=s.find("."); 12 | a=stoi(s.substr(0, 2)); 13 | cout< 2 | using namespace std; 3 | long long int n, i; 4 | vector v, u; 5 | int main() 6 | { 7 | cin>>n; 8 | for(i=0;i>v[i]; 10 | } 11 | sort(v.begin(), v.end()); 12 | for(i=0;i<(n/2);i++){ 13 | cout< 2 | using namespace std; 3 | long long int n, i, temp; 4 | vector > v; 5 | int main() 6 | { 7 | cin>>n; 8 | for(i=0;i>temp; 10 | v.push_back(make_pair(temp, i+1)); 11 | } 12 | sort(v.begin(), v.end()); 13 | for(i=0;i 2 | using namespace std; 3 | long long int n, m, a, b, i, j; 4 | set v, u; 5 | int main() 6 | { 7 | cin>>n>>m; 8 | for(i=0;i>a>>b; 10 | v.insert(a); 11 | u.insert(b); 12 | cout<<(n-v.size())*(n-u.size())<<" "; 13 | } 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /Competitions/Codeforces/Codeforces Round #366 (Div. 2)/Hulk.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | long long int n, i; 4 | int main() 5 | { 6 | cin>>n; 7 | cout<<"I hate "; 8 | for(i=1;i 2 | using namespace std; 3 | const int MAXN=100001; 4 | int main (){ 5 | int n; 6 | long long x=0; 7 | long a[MAXN]; 8 | cin >> n; 9 | for (int i=0; i> a[i]; 11 | x+=a[i]-1; 12 | if (x%2==1) cout<<1< 2 | using namespace std; 3 | long long int a[100005], i, j, n, q, b; 4 | int main() 5 | { 6 | cin>>n; 7 | for(i=0;i>a[i]; 9 | } 10 | sort(a, a+n); 11 | cin>>q; 12 | for(i=0;i>b; 14 | cout< 2 | using namespace std; 3 | long long int n, a[1000005], i; 4 | string s[1005]; 5 | int main() 6 | { 7 | cin>>n; 8 | for(i=0;i>a[i]; 10 | } 11 | for(i=0;i 2 | using namespace std; 3 | long long int n, c, a, b, ans, i; 4 | int main() 5 | { 6 | cin>>n>>c>>b; 7 | ans=1; 8 | for(i=0;i>b; 10 | if(b-a<=c){ 11 | ans++; 12 | } 13 | else { 14 | ans=1; 15 | } 16 | a=b; 17 | } 18 | cout< 2 | using namespace std; 3 | int main() 4 | { 5 | long long int n, a, b, i, j; 6 | string s; 7 | cin>>n>>a>>b>>s; 8 | if(s[a-1]==s[b-1]){ 9 | cout<<"0"< 2 | using namespace std; 3 | int main() 4 | { 5 | long long int n; 6 | cin>>n; 7 | if(n==1){ 8 | cout<<"-1"< 2 | using namespace std; 3 | int main() 4 | { 5 | long long int n, i; 6 | char c; 7 | string s; 8 | set v; 9 | cin>>s; 10 | v.insert(s); 11 | for(i=0;i 2 | using namespace std; 3 | int main() 4 | { 5 | long long int a, b, c; 6 | cin>>a>>b>>c; 7 | b = b / 2; 8 | c = c / 4; 9 | cout< 2 | using namespace std; 3 | int main() 4 | { 5 | long long int a, b; 6 | cin>>a>>b; 7 | if((abs(a-b) == 1 || a == b) && b > 0){ 8 | cout<<"YES"< 2 | using namespace std; 3 | int main() 4 | { 5 | string a, b; 6 | cin>>a>>b; 7 | if(a == b){ 8 | cout<<"-1"< 2 | using namespace std; 3 | int main() 4 | { 5 | int k, a, b, ans; 6 | cin>>k>>a>>b; 7 | ans = (a / k) + (b / k); 8 | if(((a%k) && b 2 | using namespace std; 3 | int main() 4 | { 5 | long long int a, b; 6 | cin>>a>>b; 7 | a = a % 3; 8 | if(a <= b){ 9 | cout< 2 | using namespace std; 3 | int main() 4 | { 5 | long long int n, a, b, i; 6 | vector v; 7 | cin>>n>>a>>b; 8 | v.resize(n); 9 | for(i = 0; i < n; ++i){ 10 | cin>>v[i]; 11 | } 12 | cout< 2 | using namespace std; 3 | long long int a, b, c, q, i, j; 4 | string s, ss; 5 | char cc; 6 | int main() 7 | { 8 | cin>>s>>q; 9 | for(i=0;i>a>>b>>c; 11 | ss=""; 12 | ss=s.substr(a-1, b-a+1); 13 | for(j=0;j 2 | using namespace std; 3 | long long int t, n, i, a, j, temp; 4 | int main() 5 | { 6 | cin>>t; 7 | for(i=0;i>n; 9 | a=(n*(n+1))/2; 10 | temp=1; 11 | while(temp<=n){ 12 | a=a-temp*2; 13 | temp=temp*2; 14 | } 15 | cout< 2 | #include 3 | using namespace std; 4 | long long int n, p, i, j, temp; 5 | int main() 6 | { 7 | cin>>n>>p; 8 | temp=0; 9 | for(i=1;i<=n*2;i++) 10 | { 11 | if(i+n*2<=p) 12 | { 13 | cout< 2 | using namespace std; 3 | string s; 4 | int main() 5 | { 6 | cin>>s; 7 | if(s=="a1" || s=="a8" || s=="h1" || s=="h8"){ 8 | cout<<"3"< 2 | using namespace std; 3 | long long int n, a[300005], i, j; 4 | int main() 5 | { 6 | cin>>n; 7 | for(i=0;i>a[i]; 9 | } 10 | sort(a, a+n); 11 | if(n%2==0){ 12 | cout< 2 | using namespace std; 3 | int main() 4 | { 5 | long long int n, k, i, j, ans; 6 | cin>>n>>k; 7 | ans = 0; 8 | for(i=1;i<=n;i++){ 9 | if(k + (i*5)>240){ 10 | break; 11 | } 12 | k = k + (i*5); 13 | ans++; 14 | //cout<= data[1]: 10 | power -= data[1] 11 | else: 12 | count += 1 13 | print count 14 | -------------------------------------------------------------------------------- /Competitions/Facebook Hacker Cup/2017 Online Qualification Round/Problem 1/Problem 1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Competitions/Facebook Hacker Cup/2017 Online Qualification Round/Problem 1/Problem 1 -------------------------------------------------------------------------------- /Competitions/Facebook Hacker Cup/2017 Online Qualification Round/Problem 1/sample-input.txt: -------------------------------------------------------------------------------- 1 | 5 2 | 0 55 55 3 | 12 55 55 4 | 13 55 55 5 | 99 99 99 6 | 87 20 40 7 | -------------------------------------------------------------------------------- /Competitions/Facebook Hacker Cup/2017 Online Qualification Round/Problem 1/sample-output.txt: -------------------------------------------------------------------------------- 1 | Case #1: white 2 | Case #2: white 3 | Case #3: black 4 | Case #4: white 5 | Case #5: black 6 | -------------------------------------------------------------------------------- /Competitions/Facebook Hacker Cup/2017 Online Qualification Round/Problem 2/Problem 2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Competitions/Facebook Hacker Cup/2017 Online Qualification Round/Problem 2/Problem 2 -------------------------------------------------------------------------------- /Competitions/Facebook Hacker Cup/2017 Online Qualification Round/Problem 2/sample-input.txt: -------------------------------------------------------------------------------- 1 | 5 2 | 4 3 | 30 4 | 30 5 | 1 6 | 1 7 | 3 8 | 20 9 | 20 10 | 20 11 | 11 12 | 1 13 | 2 14 | 3 15 | 4 16 | 5 17 | 6 18 | 7 19 | 8 20 | 9 21 | 10 22 | 11 23 | 6 24 | 9 25 | 19 26 | 29 27 | 39 28 | 49 29 | 59 30 | 10 31 | 32 32 | 56 33 | 76 34 | 8 35 | 44 36 | 60 37 | 47 38 | 85 39 | 71 40 | 91 41 | -------------------------------------------------------------------------------- /Competitions/Facebook Hacker Cup/2017 Online Qualification Round/Problem 2/sample-output.txt: -------------------------------------------------------------------------------- 1 | Case #1: 2 2 | Case #2: 1 3 | Case #3: 2 4 | Case #4: 3 5 | Case #5: 8 6 | -------------------------------------------------------------------------------- /Competitions/Facebook Hacker Cup/2017 Online Qualification Round/Solutions.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Competitions/Facebook Hacker Cup/2017 Online Qualification Round/Solutions.zip -------------------------------------------------------------------------------- /Competitions/Google Code Jam/Qualification Round 2017/Problem 1/sample-input.in: -------------------------------------------------------------------------------- 1 | 3 2 | ---+-++- 3 3 | +++++ 4 4 | -+-+- 4 5 | -------------------------------------------------------------------------------- /Competitions/Google Code Jam/Qualification Round 2017/Problem 1/sample-output.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Competitions/Google Code Jam/Qualification Round 2017/Problem 1/sample-output.out -------------------------------------------------------------------------------- /Competitions/Google Code Jam/Qualification Round 2017/Problem 2/sample-input.in: -------------------------------------------------------------------------------- 1 | 4 2 | 132 3 | 1000 4 | 7 5 | 111111111111111110 6 | -------------------------------------------------------------------------------- /Competitions/Google Code Jam/Qualification Round 2017/Problem 2/sample-output.out: -------------------------------------------------------------------------------- 1 | Case #1: 129 2 | Case #2: 999 3 | Case #3: 7 4 | Case #4: 99999999999999999 5 | -------------------------------------------------------------------------------- /Competitions/Google Code Jam/Qualification Round 2017/Problem 3/sample-input.in: -------------------------------------------------------------------------------- 1 | 27 2 | 4 2 3 | 5 2 4 | 6 2 5 | 1000 1000 6 | 1000 1 7 | 5 1 8 | 5 2 9 | 5 3 10 | 5 4 11 | 5 5 12 | 7 1 13 | 7 2 14 | 7 3 15 | 7 4 16 | 7 5 17 | 7 6 18 | 7 7 19 | 4 1 20 | 4 2 21 | 4 3 22 | 4 4 23 | 6 1 24 | 6 2 25 | 6 3 26 | 6 4 27 | 6 5 28 | 6 6 29 | -------------------------------------------------------------------------------- /Competitions/Google Code Jam/Qualification Round Africa 2010/Reverse Words/B-small-practice.in: -------------------------------------------------------------------------------- 1 | 5 2 | this is a test 3 | foobar 4 | all your base 5 | class 6 | pony along 7 | -------------------------------------------------------------------------------- /Competitions/Google Code Jam/Qualification Round Africa 2010/Reverse Words/sample-input.txt: -------------------------------------------------------------------------------- 1 | 3 2 | this is a test 3 | foobar 4 | all your base -------------------------------------------------------------------------------- /Competitions/Google Code Jam/Qualification Round Africa 2010/Store Credit/sample-input.txt: -------------------------------------------------------------------------------- 1 | 3 2 | 100 3 | 3 4 | 5 75 25 5 | 200 6 | 7 7 | 150 24 79 50 88 345 3 8 | 8 9 | 8 10 | 2 1 9 4 4 56 90 3 -------------------------------------------------------------------------------- /Competitions/Google Code Jam/Round 1A 2008/Minimum Scalar Product/Problem 1.py: -------------------------------------------------------------------------------- 1 | f = open('A-large-practice.in') 2 | o = open('o2.txt', 'w') 3 | t = int(f.readline().strip()) 4 | for i in xrange(1, t + 1): 5 | n = int(f.readline().strip()) 6 | x = [int(j) for j in f.readline().strip().split(" ")] 7 | y = [int(j) for j in f.readline().strip().split(" ")] 8 | x.sort() 9 | y.sort(reverse=True) 10 | r = 0 11 | for j in xrange(0, n): 12 | r = r + x[j] * y[j] 13 | o.write("Case #{}: {}\n".format(i, r)) 14 | -------------------------------------------------------------------------------- /Competitions/Google Code Jam/Round 1A 2008/Minimum Scalar Product/o2.txt: -------------------------------------------------------------------------------- 1 | Case #1: -7839202227936 2 | Case #2: 7999201712083 3 | Case #3: -1313429236847 4 | Case #4: -3710387739618 5 | Case #5: -3414920765916 6 | Case #6: -1271937742993 7 | Case #7: -1964394407029 8 | Case #8: -1884282427866 9 | Case #9: -4044533757860 10 | Case #10: -838783451371 11 | -------------------------------------------------------------------------------- /Competitions/Google Code Jam/Round 1A 2008/Minimum Scalar Product/output.out: -------------------------------------------------------------------------------- 1 | Case #1: -7839202227936 2 | Case #2: 7999201712083 3 | Case #3: -1313429236847 4 | Case #4: -3710387739618 5 | Case #5: -3414920765916 6 | Case #6: -1271937742993 7 | Case #7: -1964394407029 8 | Case #8: -1884282427866 9 | Case #9: -4044533757860 10 | Case #10: -838783451371 11 | -------------------------------------------------------------------------------- /Competitions/Google Kickstart/2017 Round A APAC/Country Leader/sample-input.txt: -------------------------------------------------------------------------------- 1 | 2 2 | 3 3 | ADAM 4 | BOB 5 | JOHNSON 6 | 2 7 | DEF 8 | A AB C -------------------------------------------------------------------------------- /Competitions/Google Kickstart/2017 Round A/Problem 1/Problem 1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Competitions/Google Kickstart/2017 Round A/Problem 1/Problem 1 -------------------------------------------------------------------------------- /Competitions/Google Kickstart/2017 Round A/Problem 1/sample-input.txt: -------------------------------------------------------------------------------- 1 | 4 2 | 2 4 3 | 3 4 4 | 4 4 5 | 1000 500 6 | -------------------------------------------------------------------------------- /Competitions/Google Kickstart/2017 Round A/Problem 2/Problem 2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Competitions/Google Kickstart/2017 Round A/Problem 2/Problem 2 -------------------------------------------------------------------------------- /Competitions/Google Kickstart/2017 Round A/Problem 2/sample-input.txt: -------------------------------------------------------------------------------- 1 | 4 2 | **** 3 | It 4 | Shakes*e 5 | S*speare 6 | Shakes*e 7 | *peare 8 | efaa*bb 9 | ef* 10 | *abcd 11 | *d 12 | -------------------------------------------------------------------------------- /Competitions/Google Kickstart/2017 Round B APAC/Problem 1/sample-input.txt: -------------------------------------------------------------------------------- 1 | 3 2 | 1 0 3 | 1 1 4 | 3 2 -------------------------------------------------------------------------------- /Competitions/Google Kickstart/2017 Round B APAC/Problem 2/sample-input.txt: -------------------------------------------------------------------------------- 1 | 3 2 | 1 1 5 3 3 | 1 2 4 5 4 | 1 1 2 2 -------------------------------------------------------------------------------- /Competitions/Google Kickstart/2017 Round C APAC/Problem 1/Problem 1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | long long int t, a, b, ans, i; 4 | set c; 5 | int main() 6 | { 7 | /*ifstream input; 8 | input.open("A-large.in"); 9 | ofstream output; 10 | output.open("output.out");*/ 11 | 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /Competitions/Google Kickstart/2017 Round C APAC/Problem 1/sample-input.txt: -------------------------------------------------------------------------------- 1 | 3 2 | 1 0 3 | 1 1 4 | 3 2 -------------------------------------------------------------------------------- /Competitions/Google Kickstart/2017 Round C/Problem A/o1.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Competitions/Google Kickstart/2017 Round C/Problem A/o1.txt -------------------------------------------------------------------------------- /Competitions/Google Kickstart/2017 Round C/Problem A/sample-input.txt: -------------------------------------------------------------------------------- 1 | 3 2 | OMDU 3 | BCB 4 | AOAAAN -------------------------------------------------------------------------------- /Competitions/Google Kickstart/2017 Round D APAC/Problem 1/Problem 1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | long long int t, i; 4 | float n, m; 5 | int main() 6 | { 7 | ifstream input; 8 | input.open("A-large.in"); 9 | ofstream output; 10 | output.open("output.out"); 11 | input>>t; 12 | for(i=0;i>n>>m; 14 | output<<"Case #"< 3: 4 | for i in xrange(0, len(a)-3): 5 | if a[i] != a[i+1] and a[i] != a[i] 6 | 7 | -------------------------------------------------------------------------------- /Competitions/HackerEarth/March Clash '17/Minimal Popcount.py: -------------------------------------------------------------------------------- 1 | n = int(raw_input(), 2) 2 | min = 0 ^ (n + 0) 3 | for i in xrange(0, n+1): 4 | if min > i ^ (n + i): 5 | min = i ^ (n + i) 6 | print min 7 | 8 | -------------------------------------------------------------------------------- /Competitions/HackerEarth/September Circuits '17/Coin Game.py: -------------------------------------------------------------------------------- 1 | def ans(n): 2 | count = 0 3 | while n % 2 == 0: 4 | count += 1 5 | n /= 2 6 | return count 7 | t = int(raw_input()) 8 | for i in xrange(t): 9 | n = int(raw_input()) 10 | data = [int(j) for j in raw_input().strip().split()] 11 | count = 0 12 | for j in xrange(n): 13 | count += ans(data[j]) 14 | if count % 2 == 0: 15 | print "Alan" 16 | else: 17 | print "Charlie" -------------------------------------------------------------------------------- /Competitions/Skillenza/Blume Fellows Challenge/IntouchApp Recruitment Test/circle.py: -------------------------------------------------------------------------------- 1 | def check(x1, y1, r1, x2, y2, r2): 2 | distance = ((x1-x2) ** 2 + (y1-y2) ** 2) ** 0.5 3 | if distance >= (r1+r2): 4 | return "Circle doesn't overlap" 5 | return "Circle overlap" 6 | 7 | #Input Circle 1 center coordinates and its radius, Circle 2 center coordinates and its radius 8 | a = [float(i) for i in raw_input().split()] 9 | print check(a[0], a[1], a[2], a[3], a[4], a[5]) 10 | -------------------------------------------------------------------------------- /Competitions/Skillenza/Code Golf Sample test/Sum of two numbers: -------------------------------------------------------------------------------- 1 | t = int(raw_input().strip()) 2 | for i in xrange(t): 3 | d = [int(j) for j in raw_input().strip().split()] 4 | print sum(d) -------------------------------------------------------------------------------- /Competitions/Skillenza/Code Golf September Part 1/Parity Check Python3.py: -------------------------------------------------------------------------------- 1 | for i in range(int(input())): 2 | if input().count('1') % 2 == 0: 3 | print('N') 4 | else: 5 | print('Y') -------------------------------------------------------------------------------- /Competitions/Skillenza/Code Golf September Part 1/Parity Check.py: -------------------------------------------------------------------------------- 1 | t = int(raw_input().strip()) 2 | for i in xrange(t): 3 | s = raw_input() 4 | if s.count('1') % 2 == 0: 5 | print 'N' 6 | else: 7 | print 'Y' -------------------------------------------------------------------------------- /Competitions/Skillenza/Focuthon/Cubic Root.py: -------------------------------------------------------------------------------- 1 | def g(a, b): 2 | while b: 3 | a, b = b, a%b 4 | return a 5 | t = int(raw_input()) 6 | for i in xrange(0, t): 7 | a = [int(j) for j in raw_input().split(' ')] 8 | print g(a[2], a[3]) / g(a[0], a[1]) 9 | -------------------------------------------------------------------------------- /Competitions/Skillenza/Focuthon/Integer Size Comparison.py: -------------------------------------------------------------------------------- 1 | import math 2 | t = int(raw_input()) 3 | for i in xrange(0, t): 4 | a = long(raw_input()) 5 | b = long(raw_input()) 6 | c = long(raw_input()) 7 | d = long(raw_input()) 8 | if b * math.log1p(a) == d * math.log1p(c): 9 | print "E" 10 | elif b * math.log1p(a) > d * math.log1p(c): 11 | print "Y" 12 | else: 13 | print "N" 14 | -------------------------------------------------------------------------------- /Competitions/Skillenza/Focuthon/String Replacement.py: -------------------------------------------------------------------------------- 1 | n = int(raw_input()) 2 | for i in xrange(0, n): 3 | s = raw_input() 4 | s = s.replace('a', 'v#nt&r#s!ty').replace('e', 'v#nt&r#s!ty').replace('i', 'v#nt&r#s!ty').replace('o', 'v#nt&r#s!ty').replace('u', 'v#nt&r#s!ty').replace('A', 'v#nt&r#s!ty').replace('E', 'v#nt&r#s!ty').replace('I', 'v#nt&r#s!ty').replace('O', 'v#nt&r#s!ty').replace('U', 'v#nt&r#s!ty') 5 | s = s.replace('#', 'e').replace('&', 'u').replace('!', 'i') 6 | print s 7 | -------------------------------------------------------------------------------- /Competitions/Skillenza/Focuthon/Trailing zeroes.py: -------------------------------------------------------------------------------- 1 | def c(n): 2 | a = 0 3 | i = 5 4 | while n / i >= 1: 5 | a += n / i 6 | i = i * 5 7 | return a 8 | t = int(raw_input()) 9 | for i in xrange(0, t): 10 | a = raw_input().split(' ') 11 | print c(int(a[0])) * int(a[1]) 12 | -------------------------------------------------------------------------------- /Competitions/Skillenza/Focuthon/V Shape.py: -------------------------------------------------------------------------------- 1 | import sys 2 | S = sys.stdout.write 3 | X = xrange 4 | R = raw_input 5 | t = int(R()) 6 | for i in X(0, t): 7 | a = R().split() 8 | a[1] = int(a[1]) 9 | for j in X(0, a[1]): 10 | b = a[1]-j-2 11 | for k in X(0, j): 12 | S(' ') 13 | S(a[0]) 14 | for k in X(0, b): 15 | S(' ') 16 | if j != a[1] - 1: 17 | S(' '+a[0]) 18 | S('\n') 19 | -------------------------------------------------------------------------------- /Competitions/Skillenza/September Stupendousness/Tyrion fights Bran.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Competitions/Skillenza/September Stupendousness/Tyrion fights Bran.py -------------------------------------------------------------------------------- /Competitions/TechGig/Virtual Campus League 2017/Problem 1.py: -------------------------------------------------------------------------------- 1 | def possibleways(input1): 2 | sum = 0 3 | for i in input1: 4 | sum += i 5 | ans = 0 6 | for i in xrange(len(input1)): 7 | ans += (i + 1) * sum * input1[i] 8 | sum -= input1[i] 9 | ans %= 10 ** 9 + 7 10 | return ans -------------------------------------------------------------------------------- /Competitions/TopCoder/Humblefool Cup Round 1/250.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | class Robofactory { 4 | public : 5 | int reveal(int[] query, string[] answer){ 6 | long long int 7 | } 8 | }; 9 | int main(){ 10 | } 11 | -------------------------------------------------------------------------------- /Competitions/TopCoder/SRM 698/250.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | class Initials { 4 | public : string getInitials(string s){ 5 | string c=""; 6 | c.push_back(s[0]); 7 | for(int i=1;i0 for i in x]) and any([j == j[::-1] for j in x])) 6 | 7 | -------------------------------------------------------------------------------- /Hackerrank_python/12.Python Functionals/77.Map and Lambda Function.py: -------------------------------------------------------------------------------- 1 | cube = lambda x: x**3# complete the lambda function 2 | def fibonacci(n): 3 | # return a list of fibonacci numbers 4 | lis = [0,1] 5 | for i in range(2,n): 6 | lis.append(lis[i-2] + lis[i-1]) 7 | return(lis[0:n]) # complete the lambda function 8 | 9 | 10 | if __name__ == '__main__': 11 | n = int(input()) 12 | print(list(map(cube, fibonacci(n)))) 13 | -------------------------------------------------------------------------------- /Hackerrank_python/13.Regex and Parsing/80.Detect Floating Point Number.py: -------------------------------------------------------------------------------- 1 | # Enter your code here. Read input from STDIN. Print output to STDOUT 2 | import re 3 | for i in range(int(input())): 4 | x=input() 5 | #print(bool(re.match([r'^[-+]?[0-9]*.[0-9]+$'],input()))) 6 | print(bool(re.match(r'^[-+]?[0-9]*[.][0-9]*$',x))) 7 | -------------------------------------------------------------------------------- /Hackerrank_python/13.Regex and Parsing/81.Re.split().py: -------------------------------------------------------------------------------- 1 | regex_pattern = r'[,.]' 2 | import re 3 | print("\n".join(re.split(regex_pattern, input()))) 4 | -------------------------------------------------------------------------------- /Hackerrank_python/13.Regex and Parsing/82.Group(), Groups() & Groupdict().py: -------------------------------------------------------------------------------- 1 | # Enter your code here. Read input from STDIN. Print output to STDOUT 2 | import re 3 | m = re.search(r'([a-zA-Z0-9])\1', input()) 4 | #print(m.group(1) if m else -1) 5 | if m: 6 | print(m.group(1)) 7 | else: 8 | print(-1) 9 | 10 | -------------------------------------------------------------------------------- /Hackerrank_python/13.Regex and Parsing/83.Re.findall() & Re.finditer().py: -------------------------------------------------------------------------------- 1 | # Enter your code here. Read input from STDIN. Print output to STDOUTi 2 | import re 3 | sub_string=re.findall(r'(?<=[qwrtypsdfghjklzxcvbnm])([aeiou]{2,})(?=[qwrtypsdfghjklzxcvbnm])',input(),re.I) 4 | ''' 5 | if sub_string: 6 | for s in sub_string: 7 | print(s) 8 | else: 9 | print(-1) 10 | ''' 11 | print('\n'.join(sub_string or ['-1'])) 12 | #print('\n'.join(sub_string or ['-1'])) 13 | 14 | 15 | -------------------------------------------------------------------------------- /Hackerrank_python/13.Regex and Parsing/86.Validating Roman Numerals.py: -------------------------------------------------------------------------------- 1 | regex_pattern = r"^M{0,3}(CD|CM|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$" # Do not delete 'r'. 2 | 3 | import re 4 | print(str(bool(re.match(regex_pattern, input())))) 5 | -------------------------------------------------------------------------------- /Hackerrank_python/13.Regex and Parsing/88.Validating and Parsing Email Addresses.py: -------------------------------------------------------------------------------- 1 | # Enter your code here. Read input from STDIN. Print output to STDOUT 2 | import re 3 | n = int(input()) 4 | for _ in range(n): 5 | x, y = input().split() 6 | m = re.match(r'^<[a-zA-Z][\w\-\.\_]+@[a-zA-Z]+\.[a-zA-Z]{1,3}>$', y) 7 | if m: 8 | print(x,y) 9 | #(r'^<[a-zA-Z0-9_.-]+@[a-zA-Z]+\.[a-zA-Z]{1,3}>$', y) 10 | -------------------------------------------------------------------------------- /Hackerrank_python/13.Regex and Parsing/89.Hex Color Code.py: -------------------------------------------------------------------------------- 1 | # Enter your code here. Read input from STDIN. Print output to STD 2 | import re 3 | N = int(input()) 4 | for _ in range(N): 5 | line = input() 6 | codes = [j for j in re.findall(r'[\s:](#[a-f\d]{6}|#[a-f\d]{3})[\s:),;]', line, re.I)] 7 | #here \d means(0,9) 8 | for code in codes: 9 | print (code) 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Hackerrank_python/13.Regex and Parsing/95.Validating Postal Codes.py: -------------------------------------------------------------------------------- 1 | regex_integer_in_range = r"^[1-9][\d]{5}$" # Do not delete 'r'. 2 | regex_alternating_repetitive_digit_pair = r"(\d)(?=\d\1)" # Do not delete 'r'. 3 | 4 | 5 | import re 6 | P = input() 7 | 8 | print (bool(re.match(regex_integer_in_range, P)) 9 | and len(re.findall(regex_alternating_repetitive_digit_pair, P)) < 2) 10 | -------------------------------------------------------------------------------- /Hackerrank_python/13.Regex and Parsing/96.Matrix Script.py: -------------------------------------------------------------------------------- 1 | #!/bin/python3 2 | import re 3 | n,m=map(int,input().split()) 4 | l=list() 5 | for i in range(n): 6 | l.append(input()) 7 | l=list(zip(*l)) 8 | #print(l) 9 | s="" 10 | for i in l: 11 | s=s+"".join(i) 12 | #print(s) 13 | s=re.sub(r"\b[^a-zA-Z0-9]+\b",r" ",s) 14 | print(s) 15 | -------------------------------------------------------------------------------- /Hackerrank_python/14.Closures and Decorators/99.Standardize Mobile Number Using Decorators.py: -------------------------------------------------------------------------------- 1 | def wrapper(f): 2 | def fun(l): 3 | f(["+91 "+c1[-10:-5]+" "+c1[-5:] for c1 in l]) 4 | # complete the function 5 | return fun 6 | 7 | @wrapper 8 | def sort_phone(l): 9 | print(*sorted(l), sep='\n') 10 | 11 | if __name__ == '__main__': 12 | l = [input() for _ in range(int(input()))] 13 | sort_phone(l) 14 | 15 | 16 | -------------------------------------------------------------------------------- /Hackerrank_python/15.numpy/1.Arrays.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | 3 | def arrays(arr): 4 | # complete this function 5 | # use numpy.array 6 | return numpy.array(arr[::-1],float) 7 | 8 | arr = input().strip().split(' ') 9 | result = arrays(arr) 10 | print(result) 11 | -------------------------------------------------------------------------------- /Hackerrank_python/15.numpy/10.Min and Max.py: -------------------------------------------------------------------------------- 1 | import numpy as arr 2 | n,m=map(int,input().split()) 3 | ar=([list(map(int,input().split()))for _ in range(n)]) 4 | arr1=arr.min(ar,axis=1) 5 | print(max(arr1)) 6 | -------------------------------------------------------------------------------- /Hackerrank_python/15.numpy/11.Mean, Var, and Std .py: -------------------------------------------------------------------------------- 1 | import numpy as maa 2 | n,m=map(int,input().split()) 3 | maa.set_printoptions(legacy='1.13') 4 | arr=([list(map(int,input().split()))for _ in range(n)]) 5 | print(maa.mean(arr,axis=1)) 6 | print(maa.var(arr,axis=0)) 7 | print(maa.std(arr,axis=None)) 8 | -------------------------------------------------------------------------------- /Hackerrank_python/15.numpy/12.Dot and Cross.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | n=int(input()) 3 | arr1=([list(map(int,input().split()))for _ in range(n)]) 4 | arr2=([list(map(int,input().split()))for _ in range(n)]) 5 | print(numpy.dot(arr1,arr2)) 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Hackerrank_python/15.numpy/13.Inner and Outer.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | arr1=numpy.array(input().split(),int) 3 | arr2=(numpy.array(input().split(),int)) 4 | print(numpy.inner(arr1,arr2)) 5 | print(numpy.outer(arr1,arr2)) 6 | 7 | 8 | -------------------------------------------------------------------------------- /Hackerrank_python/15.numpy/14.Polynomials.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | lis=numpy.array(input().split(),float) 3 | x=int(input()) 4 | print(numpy.polyval(lis,x)) 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Hackerrank_python/15.numpy/15.Linear Algebra.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | n=int(input()) 3 | numpy.set_printoptions(legacy='1.13') 4 | arr1=([list(map(float,input().split()))for _ in range(n)]) 5 | print (numpy.linalg.det(arr1)) 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Hackerrank_python/15.numpy/2.Shape and Reshape.py: -------------------------------------------------------------------------------- 1 | 2 | import numpy as num 3 | x=num.array (input().split(),int) 4 | print(x.reshape(3,3)) 5 | #print(np.array(input().split(),int).reshape(3,3)) 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Hackerrank_python/15.numpy/3.Transpose and Flatten.py: -------------------------------------------------------------------------------- 1 | import numpy as num 2 | n, m = map(int, input().split()) 3 | array = num.array([input().split() for _ in range(n)], int) 4 | print (array.transpose()) 5 | print (array.flatten()) 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Hackerrank_python/15.numpy/4.Concatenate.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | n, m, p = map(int,input().split()) 3 | arrp1 = np.array([input().split() for _ in range(n)],int) 4 | arrp2 = np.array([input().split() for _ in range(m)],int) 5 | print(np.concatenate((arrp1, arrp2), axis = 0)) 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Hackerrank_python/15.numpy/5.Zeros and Ones.py: -------------------------------------------------------------------------------- 1 | import numpy as num 2 | x=num.array (input().split(),int) 3 | print(num.zeros(x,dtype="int")) 4 | print(num.ones(x,dtype="int")) 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Hackerrank_python/15.numpy/6.Eye and Identity.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | #n,m=map(int,input().split())#this one also correct 3 | n,m=np.array(input().split(),int) 4 | np.set_printoptions(legacy='1.13') 5 | print(np.eye(n,m)) 6 | 7 | 8 | -------------------------------------------------------------------------------- /Hackerrank_python/15.numpy/7.Array Mathematics.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | n,m=map(int,input().split()) 3 | 4 | 5 | print(np.add()) 6 | -------------------------------------------------------------------------------- /Hackerrank_python/15.numpy/8.Floor, Ceil and Rint.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | numpy.set_printoptions(legacy='1.13') 3 | n=numpy.array(input().split(),float) 4 | print(numpy.floor(n)) 5 | print(numpy.ceil(n)) 6 | print(numpy.rint(n)) 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Hackerrank_python/15.numpy/9.Sum and Prod.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | import numpy as np 3 | n,m = map(int,input().split()) 4 | arr = np.array([input().split() for i in range(n)], int) 5 | x=np.sum(arr,axis=0) 6 | print(np.prod(x)) 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Hackerrank_python/15.numpy/README.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Hackerrank_python/16.XML/97.XML 1 - Find the Score.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import xml.etree.ElementTree as etree 3 | 4 | def get_attr_number(node): 5 | # your code goes here 6 | return etree.tostring(node).count(b'=') 7 | 8 | 9 | 10 | if __name__ == '__main__': 11 | sys.stdin.readline() 12 | xml = sys.stdin.read() 13 | tree = etree.ElementTree(etree.fromstring(xml)) 14 | root = tree.getroot() 15 | print(get_attr_number(root)) 16 | -------------------------------------------------------------------------------- /Hackerrank_python/17.debugging/1.Words Score.py: -------------------------------------------------------------------------------- 1 | 2 | def is_vowel(letter): 3 | return letter in ['a', 'e', 'i', 'o', 'u', 'y'] 4 | 5 | def score_words(words): 6 | score = 0 7 | for word in words: 8 | num_vowels = 0 9 | for letter in word: 10 | if is_vowel(letter): 11 | num_vowels += 1 12 | if num_vowels % 2 == 0: 13 | score += 2 14 | else: 15 | score=score+1 16 | return score 17 | 18 | -------------------------------------------------------------------------------- /Hackerrank_python/17.debugging/README.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Hackerrank_python/2.basic data types/08.List Comprehensions.py: -------------------------------------------------------------------------------- 1 | if __name__ == '__main__': 2 | x = int(input()) 3 | y = int(input()) 4 | z = int(input()) 5 | n = int(input()) 6 | k=([[i,j,l]for i in range(x+1) for j in range(y+1) for l in range(z+1) if (i+j+l!=n)]) 7 | print(k) 8 | 9 | 10 | -------------------------------------------------------------------------------- /Hackerrank_python/2.basic data types/09.Find the Runner-Up Score!.py: -------------------------------------------------------------------------------- 1 | if __name__ == '__main__': 2 | n = int(input()) 3 | arr =list(map(int,input().split())) 4 | maxx=max(arr) 5 | temp=0 6 | while (temp 2 | 3 | Property Registration App 4 | 5 | 6 |
7 |
8 | 9 | -------------------------------------------------------------------------------- /Hiring Challenges/Bosch Blockchain Developer Hiring/Round 2/src/dapp/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import App from './react-app/App'; 4 | 5 | ReactDOM.render(, document.getElementById('root')); -------------------------------------------------------------------------------- /Hiring Challenges/Bosch Blockchain Developer Hiring/Round 2/src/server/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "localhost": { 3 | "url": "http://localhost:7545", 4 | "serverURL": "http://localhost:3000", 5 | "appAddress": "0xD5E8AA91BDa51688e6f3De82E52Fb38E35298515" 6 | } 7 | } -------------------------------------------------------------------------------- /Hiring Challenges/Bosch Blockchain Developer Hiring/Round 2/src/server/index.js: -------------------------------------------------------------------------------- 1 | import http from 'http' 2 | import app from './server' 3 | 4 | const server = http.createServer(app); 5 | let currentApp = app; 6 | server.listen(3000); 7 | 8 | if (module.hot) { 9 | module.hot.accept('./server', () => { 10 | server.removeListener('request', currentApp); 11 | server.on('request', app); 12 | currentApp = app; 13 | }) 14 | } 15 | -------------------------------------------------------------------------------- /Hiring Challenges/Google-Foobar/53-12-g8f9a222a-beta/Level 1/1.py: -------------------------------------------------------------------------------- 1 | def answer(data, n): 2 | t = {} 3 | for d in data: 4 | t[d] = t.get(d, 0) + 1 5 | for d in t: 6 | if t[d] > n: 7 | for i in range(t[d]): 8 | data.remove(d) 9 | return data 10 | print answer([5, 10, 15, 10, 7], 1) 11 | print answer([1, 2, 3], 0) 12 | print answer([1, 2, 2, 3, 3, 3, 4, 5, 5], 1) 13 | print answer([1, 2, 3], 6) 14 | -------------------------------------------------------------------------------- /Hiring Challenges/Twitter/University 2018 - Test 7/Q1.md: -------------------------------------------------------------------------------- 1 | # Question 2 | https://www.hackerrank.com/challenges/binary-search-tree-1/problem 3 | 4 | # Solution 5 | SELECT ID, CASE WHEN P_ID IS NULL THEN 'ROOT' WHEN (SELECT COUNT(*) FROM TREE WHERE P_ID = T.ID) THEN 'INNER' ELSE 'LEAF' END FROM TREE as T ORDER BY ID -------------------------------------------------------------------------------- /Hiring Challenges/Twitter/University 2018 - Test 7/Q3.py: -------------------------------------------------------------------------------- 1 | # Modification of this problem http://www.geeksforgeeks.org/count-possible-paths-top-left-bottom-right-nxm-matrix/ 2 | 3 | def krakenCount(m, n): 4 | if m == 1 or n == 1: 5 | return 1 6 | return krakenCount(m-1, n) + krakenCount(m-1, n-1) + krakenCount(m, n-1) 7 | -------------------------------------------------------------------------------- /Interviews/11TechSquare/11TechSquare Offer Letter Summer 2017(Manish Bisht).pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Interviews/11TechSquare/11TechSquare Offer Letter Summer 2017(Manish Bisht).pdf -------------------------------------------------------------------------------- /Interviews/11TechSquare/edited_11TechSquare Offer Letter Summer 2017(Manish Bisht).pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Interviews/11TechSquare/edited_11TechSquare Offer Letter Summer 2017(Manish Bisht).pdf -------------------------------------------------------------------------------- /Interviews/Coursera/Software Engineer - University Graduate 2018/Range Minimum Query.py: -------------------------------------------------------------------------------- 1 | # Enter your code here. Read input from STDIN. Print output to STDOUT 2 | 3 | data = [int(i) for i in raw_input().split()] 4 | n = data[0] 5 | m = data[1] 6 | 7 | data = [int(i) for i in raw_input().split()] 8 | 9 | for i in xrange(m): 10 | temp = [int(j) for j in raw_input().split()] 11 | a = temp[0] 12 | b = temp[1] 13 | print min(data[slice(a, b + 1)]) 14 | -------------------------------------------------------------------------------- /Interviews/Glider-ai/Screen Shot 2019-06-26 at 11.13.20 PM.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Interviews/Glider-ai/Screen Shot 2019-06-26 at 11.13.20 PM.png -------------------------------------------------------------------------------- /Interviews/Glider-ai/Screen Shot 2019-06-26 at 11.13.25 PM.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Interviews/Glider-ai/Screen Shot 2019-06-26 at 11.13.25 PM.png -------------------------------------------------------------------------------- /Interviews/Google/Software Engineer University Graduate - Tokyo 2019/Round 1 - Online Challenge/Problem 1/Not Available.txt: -------------------------------------------------------------------------------- 1 | N/A -------------------------------------------------------------------------------- /Interviews/Google/Software Engineer University Graduate - Tokyo 2019/Round 1 - Online Challenge/Problem 1/sample-input.txt: -------------------------------------------------------------------------------- 1 | 6 2 | 3 | 3 4 | 1 2 5 | 2 1 6 | 0 0 7 | 8 | 3 9 | 1 2 10 | 2 2 11 | 2 1 12 | 13 | 5 14 | 42 74 15 | 52 19 16 | 38 88 17 | 32 53 18 | 17 37 19 | 20 | 5 21 | 43 24 22 | 55 73 23 | 8 85 24 | 89 71 25 | 26 84 26 | 27 | 5 28 | 78 56 29 | 83 50 30 | 7 83 31 | 75 17 32 | 70 30 33 | 34 | 5 35 | 40 11 36 | 95 77 37 | 51 74 38 | 10 32 39 | 53 62 -------------------------------------------------------------------------------- /Interviews/Google/Software Engineer University Graduate - Tokyo 2019/Round 1 - Online Challenge/Problem 1/sample-output.txt: -------------------------------------------------------------------------------- 1 | Case #1: 5.88634951737 2 | Case #2: 3.41421356237 3 | Case #3: 73.3301882869 4 | Case #4: 97.5516125584 5 | Case #5: 58.8669115771 6 | Case #6: 100.865885445 7 | -------------------------------------------------------------------------------- /Interviews/Google/Software Engineer University Graduate - Tokyo 2019/Round 1 - Online Challenge/Problem 2/Not Available.txt: -------------------------------------------------------------------------------- 1 | N/A -------------------------------------------------------------------------------- /Interviews/Google/Software Engineer University Graduate - Tokyo 2019/Round 1 - Online Challenge/Problem 2/sample-input.txt: -------------------------------------------------------------------------------- 1 | 5 2 | 3 | 3 2 4 | 1 2 5 | 2 3 6 | 7 | 3 2 8 | 2 3 9 | 2 1 10 | 11 | 5 5 12 | 1 3 13 | 3 4 14 | 2 3 15 | 3 5 16 | 1 4 17 | 18 | 4 2 19 | 1 2 20 | 4 3 21 | 22 | 2 0 -------------------------------------------------------------------------------- /Interviews/Google/Software Engineer University Graduate - Tokyo 2019/Round 1 - Online Challenge/Problem 2/sample-output.txt: -------------------------------------------------------------------------------- 1 | Case #1: 1 2 | Case #2: -------------------------------------------------------------------------------- /Interviews/Google/Software Engineering Intern - Germany Summer 2017/Round 1 - Development Task/Development+Task.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Interviews/Google/Software Engineering Intern - Germany Summer 2017/Round 1 - Development Task/Development+Task.pdf -------------------------------------------------------------------------------- /Interviews/Google/Software Engineering Intern - Tokyo Summer 2017/Round 1 - Online Challenge/Problem 1/Not Available.txt: -------------------------------------------------------------------------------- 1 | N/A -------------------------------------------------------------------------------- /Interviews/Google/Software Engineering Intern - Tokyo Summer 2017/Round 1 - Online Challenge/Problem 1/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Interviews/Google/Software Engineering Intern - Tokyo Summer 2017/Round 1 - Online Challenge/Problem 1/README.md -------------------------------------------------------------------------------- /Interviews/Google/Software Engineering Intern - Tokyo Summer 2017/Round 1 - Online Challenge/Problem 1/sample-input.txt: -------------------------------------------------------------------------------- 1 | 4 2 | 3 | 2 4 | 50 70 5 | 6 | 3 7 | 80 90 100 8 | 9 | 1 10 | 10 11 | 12 | 2 13 | 60 60 14 | -------------------------------------------------------------------------------- /Interviews/Google/Software Engineering Intern - Tokyo Summer 2017/Round 1 - Online Challenge/Problem 1/sample-input2.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 3 | 100 4 | 32 24 99 12 49 11 72 79 56 8 98 39 0 89 79 60 83 54 0 23 84 60 16 92 79 45 90 81 12 29 96 79 45 29 33 75 74 41 41 73 26 7 76 78 48 16 96 7 43 75 87 57 17 91 58 64 31 32 63 49 100 53 2 49 45 31 94 74 69 80 56 34 93 13 13 26 71 31 98 2 10 91 19 44 28 84 64 92 89 36 6 26 11 65 88 23 63 46 45 91 -------------------------------------------------------------------------------- /Interviews/Google/Software Engineering Intern - Tokyo Summer 2017/Round 1 - Online Challenge/Problem 2/Not Available.txt: -------------------------------------------------------------------------------- 1 | N/A -------------------------------------------------------------------------------- /Interviews/Google/Software Engineering Intern - Tokyo Summer 2017/Round 1 - Online Challenge/Problem 2/sample-input.txt: -------------------------------------------------------------------------------- 1 | 4 2 | 3 | 5 4 | 3 5 | 1 2 6 | 3 4 7 | 3 5 8 | 9 | 5 10 | 2 11 | 4 2 12 | 3 1 13 | 14 | 6 15 | 0 16 | 17 | 3 18 | 3 19 | 1 2 20 | 2 1 21 | 3 3 -------------------------------------------------------------------------------- /Interviews/Google/Software Engineering Intern - Tokyo Summer 2017/Round 1 - Online Challenge/Problem 2/sample-output.txt: -------------------------------------------------------------------------------- 1 | Case #1: 3 2 2 | Case #2: 1 1 1 1 1 3 | Case #3: 1 1 1 1 1 1 4 | Case #4: 2 1 5 | -------------------------------------------------------------------------------- /Interviews/Grab/Software Development Engineer 2019 v2/Screen Shot 2019-07-06 at 9.01.08 PM.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Interviews/Grab/Software Development Engineer 2019 v2/Screen Shot 2019-07-06 at 9.01.08 PM.png -------------------------------------------------------------------------------- /Interviews/Grab/Software Development Engineer 2019 v2/Screen Shot 2019-07-06 at 9.10.11 PM.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Interviews/Grab/Software Development Engineer 2019 v2/Screen Shot 2019-07-06 at 9.10.11 PM.png -------------------------------------------------------------------------------- /Interviews/Grab/Software Development Engineer 2019 v2/Screen Shot 2019-07-06 at 9.48.30 PM.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Interviews/Grab/Software Development Engineer 2019 v2/Screen Shot 2019-07-06 at 9.48.30 PM.png -------------------------------------------------------------------------------- /Interviews/Grab/Software Development Engineer 2019 v2/Screen Shot 2019-07-06 at 9.57.02 PM.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Interviews/Grab/Software Development Engineer 2019 v2/Screen Shot 2019-07-06 at 9.57.02 PM.png -------------------------------------------------------------------------------- /Interviews/Grab/Software Development Engineer 2019/Screen Shot 2019-06-09 at 10.06.51 PM.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Interviews/Grab/Software Development Engineer 2019/Screen Shot 2019-06-09 at 10.06.51 PM.png -------------------------------------------------------------------------------- /Interviews/Grab/Software Development Engineer 2019/Screen Shot 2019-06-09 at 10.27.48 PM.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Interviews/Grab/Software Development Engineer 2019/Screen Shot 2019-06-09 at 10.27.48 PM.png -------------------------------------------------------------------------------- /Interviews/Grab/Software Development Engineer 2019/Screen Shot 2019-06-09 at 10.41.19 PM.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Interviews/Grab/Software Development Engineer 2019/Screen Shot 2019-06-09 at 10.41.19 PM.png -------------------------------------------------------------------------------- /Interviews/Grab/Software Development Engineer 2019/Screen Shot 2019-06-09 at 10.44.31 PM.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Interviews/Grab/Software Development Engineer 2019/Screen Shot 2019-06-09 at 10.44.31 PM.png -------------------------------------------------------------------------------- /Interviews/Grab/Software Development Engineer 2019/Screen Shot 2019-06-09 at 10.45.00 PM.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Interviews/Grab/Software Development Engineer 2019/Screen Shot 2019-06-09 at 10.45.00 PM.png -------------------------------------------------------------------------------- /Interviews/Grab/Software Development Engineer 2019/Screen Shot 2019-06-09 at 10.45.59 PM.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Interviews/Grab/Software Development Engineer 2019/Screen Shot 2019-06-09 at 10.45.59 PM.png -------------------------------------------------------------------------------- /Interviews/Hackerearth/Summer Intern 2016/HackerEarth Intership Snapshot.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Interviews/Hackerearth/Summer Intern 2016/HackerEarth Intership Snapshot.jpg -------------------------------------------------------------------------------- /Interviews/Hackerearth/Summer Intern 2016/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Interviews/Hackerearth/Summer Intern 2016/images/logo.png -------------------------------------------------------------------------------- /Interviews/Hackerearth/Summer Intern 2016/snapshots/final.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Interviews/Hackerearth/Summer Intern 2016/snapshots/final.jpg -------------------------------------------------------------------------------- /Interviews/Hackerearth/Summer Intern 2016/snapshots/sample.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Interviews/Hackerearth/Summer Intern 2016/snapshots/sample.jpg -------------------------------------------------------------------------------- /Interviews/Hackerearth/Summer Intern 2017/downloads/file_explorer37a715d.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Interviews/Hackerearth/Summer Intern 2017/downloads/file_explorer37a715d.zip -------------------------------------------------------------------------------- /Interviews/Hackerearth/Summer Intern 2017/downloads/file_explorer37a715d/File Explorer/File Explorer-01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Interviews/Hackerearth/Summer Intern 2017/downloads/file_explorer37a715d/File Explorer/File Explorer-01.png -------------------------------------------------------------------------------- /Interviews/Hackerearth/Summer Intern 2017/downloads/file_explorer37a715d/File Explorer/Layout/New-02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Interviews/Hackerearth/Summer Intern 2017/downloads/file_explorer37a715d/File Explorer/Layout/New-02.png -------------------------------------------------------------------------------- /Interviews/Hackerearth/Summer Intern 2017/downloads/file_explorer37a715d/File Explorer/Layout/New-04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Interviews/Hackerearth/Summer Intern 2017/downloads/file_explorer37a715d/File Explorer/Layout/New-04.png -------------------------------------------------------------------------------- /Interviews/Hackerearth/Summer Intern 2017/downloads/file_explorer37a715d/File Explorer/Layout/New-05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Interviews/Hackerearth/Summer Intern 2017/downloads/file_explorer37a715d/File Explorer/Layout/New-05.png -------------------------------------------------------------------------------- /Interviews/Hackerearth/Summer Intern 2017/downloads/file_explorer37a715d/File Explorer/Layout/With grid-04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Interviews/Hackerearth/Summer Intern 2017/downloads/file_explorer37a715d/File Explorer/Layout/With grid-04.png -------------------------------------------------------------------------------- /Interviews/Hackerearth/Summer Intern 2017/downloads/file_explorer37a715d/File Explorer/Layout/with grid-02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Interviews/Hackerearth/Summer Intern 2017/downloads/file_explorer37a715d/File Explorer/Layout/with grid-02.png -------------------------------------------------------------------------------- /Interviews/Hackerearth/Summer Intern 2017/downloads/file_explorer37a715d/File Explorer/Layout/with grid-05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Interviews/Hackerearth/Summer Intern 2017/downloads/file_explorer37a715d/File Explorer/Layout/with grid-05.png -------------------------------------------------------------------------------- /Interviews/Hackerearth/Summer Intern 2017/downloads/file_explorer37a715d/File Explorer/Resources/Folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Interviews/Hackerearth/Summer Intern 2017/downloads/file_explorer37a715d/File Explorer/Resources/Folder.png -------------------------------------------------------------------------------- /Interviews/Hackerearth/Summer Intern 2017/downloads/file_explorer37a715d/File Explorer/Resources/Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Interviews/Hackerearth/Summer Intern 2017/downloads/file_explorer37a715d/File Explorer/Resources/Logo.png -------------------------------------------------------------------------------- /Interviews/Hackerearth/Summer Intern 2017/downloads/file_explorer37a715d/File Explorer/Resources/doc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Interviews/Hackerearth/Summer Intern 2017/downloads/file_explorer37a715d/File Explorer/Resources/doc.png -------------------------------------------------------------------------------- /Interviews/Hackerearth/Summer Intern 2017/downloads/file_explorer37a715d/File Explorer/Resources/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Interviews/Hackerearth/Summer Intern 2017/downloads/file_explorer37a715d/File Explorer/Resources/image.png -------------------------------------------------------------------------------- /Interviews/Hackerearth/Summer Intern 2017/downloads/file_explorer37a715d/File Explorer/Resources/upload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Interviews/Hackerearth/Summer Intern 2017/downloads/file_explorer37a715d/File Explorer/Resources/upload.png -------------------------------------------------------------------------------- /Interviews/Hackerearth/Summer Intern 2017/images/Folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Interviews/Hackerearth/Summer Intern 2017/images/Folder.png -------------------------------------------------------------------------------- /Interviews/Hackerearth/Summer Intern 2017/images/doc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Interviews/Hackerearth/Summer Intern 2017/images/doc.png -------------------------------------------------------------------------------- /Interviews/Hackerearth/Summer Intern 2017/images/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Interviews/Hackerearth/Summer Intern 2017/images/image.png -------------------------------------------------------------------------------- /Interviews/Hackerearth/Summer Intern 2017/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Interviews/Hackerearth/Summer Intern 2017/images/logo.png -------------------------------------------------------------------------------- /Interviews/Hackerearth/Summer Intern 2017/images/upload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Interviews/Hackerearth/Summer Intern 2017/images/upload.png -------------------------------------------------------------------------------- /Interviews/Hackerearth/Summer Intern 2017/screenshots/p30.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Interviews/Hackerearth/Summer Intern 2017/screenshots/p30.png -------------------------------------------------------------------------------- /Interviews/Hackerearth/Summer Intern 2017/screenshots/p31.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Interviews/Hackerearth/Summer Intern 2017/screenshots/p31.png -------------------------------------------------------------------------------- /Interviews/Hackerearth/Summer Intern 2017/submission.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Interviews/Hackerearth/Summer Intern 2017/submission.zip -------------------------------------------------------------------------------- /Interviews/Haptik/Backend Developer/Backend Assignment.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Interviews/Haptik/Backend Developer/Backend Assignment.pdf -------------------------------------------------------------------------------- /Interviews/Haptik/Backend Developer/Task 1/README.md: -------------------------------------------------------------------------------- 1 | # Question 1 2 | 3 | You can find a file called chats.txt here, the file contains a group conversation among a group of 4 | people.. Write a function that reads from the file and returns the 3 most active users in the 5 | conversation. 6 | Chats.txt = https://s3.ap-south-1.amazonaws.com/haptikinterview/chats.txt -------------------------------------------------------------------------------- /Interviews/Haptik/Backend Developer/Task 2/api/modals/followerModal.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | const Schema = mongoose.Schema; 3 | 4 | const FollowerSchema = new Schema({ 5 | FOLLOWED_BY: { 6 | type: Schema.ObjectId, 7 | required: true 8 | }, 9 | FOLLOWED_TO: { 10 | type: Schema.ObjectId, 11 | required: true 12 | }, 13 | }, {timestamps: true}); 14 | 15 | module.exports = mongoose.model('follower', FollowerSchema); -------------------------------------------------------------------------------- /Interviews/Haptik/Backend Developer/Task 2/api/modals/postModal.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | const Schema = mongoose.Schema; 3 | 4 | const PostSchema = new Schema({ 5 | CONTENT: { 6 | type: String, 7 | maxlength: 140, 8 | required: true 9 | }, 10 | AUTHOR: { 11 | type: Schema.ObjectId, 12 | required: true 13 | }, 14 | }, {timestamps: true}); 15 | 16 | module.exports = mongoose.model('posts', PostSchema); -------------------------------------------------------------------------------- /Interviews/Haptik/Backend Developer/Task 2/api/routes/followerRoute.js: -------------------------------------------------------------------------------- 1 | module.exports = function (app) { 2 | const followerController = require('../controllers/followerController'); 3 | 4 | app.route('/follower/:userId') 5 | .get(followerController.getAllFollowers) 6 | .post(followerController.addFollower) 7 | .delete(followerController.deleteFollower) 8 | }; -------------------------------------------------------------------------------- /Interviews/Haptik/Backend Developer/Task 2/api/routes/postRoute.js: -------------------------------------------------------------------------------- 1 | module.exports = function (app) { 2 | const postController = require('../controllers/postController'); 3 | 4 | app.route('/post') 5 | .post(postController.createPost); 6 | 7 | app.route('/posts/:userId') 8 | .get(postController.getAllPosts); 9 | }; -------------------------------------------------------------------------------- /Interviews/Haptik/Backend Developer/Task 2/api/routes/userRoute.js: -------------------------------------------------------------------------------- 1 | module.exports = function (app) { 2 | const userController = require('../controllers/userController'); 3 | 4 | app.route('/signup') 5 | .post(userController.createAccount); 6 | 7 | app.route('/login') 8 | .post(userController.checkLogin); 9 | 10 | app.route('/user/:userId') 11 | .get(userController.getUserDetails); 12 | }; -------------------------------------------------------------------------------- /Interviews/Haptik/Backend Developer/Task 2/dump/twitter-clone/followers.bson: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Interviews/Haptik/Backend Developer/Task 2/dump/twitter-clone/followers.bson -------------------------------------------------------------------------------- /Interviews/Haptik/Backend Developer/Task 2/dump/twitter-clone/followers.metadata.json: -------------------------------------------------------------------------------- 1 | {"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"twitter-clone.followers"}],"uuid":"3fdcc1db4c0147168da4c311458af70e"} -------------------------------------------------------------------------------- /Interviews/Haptik/Backend Developer/Task 2/dump/twitter-clone/posts.bson: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Interviews/Haptik/Backend Developer/Task 2/dump/twitter-clone/posts.bson -------------------------------------------------------------------------------- /Interviews/Haptik/Backend Developer/Task 2/dump/twitter-clone/posts.metadata.json: -------------------------------------------------------------------------------- 1 | {"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"twitter-clone.posts"}],"uuid":"3d92858048544e56bfc3a7fba1563704"} -------------------------------------------------------------------------------- /Interviews/Haptik/Backend Developer/Task 2/dump/twitter-clone/users.bson: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Interviews/Haptik/Backend Developer/Task 2/dump/twitter-clone/users.bson -------------------------------------------------------------------------------- /Interviews/Haptik/Backend Developer/Task 2/dump/twitter-clone/users.metadata.json: -------------------------------------------------------------------------------- 1 | {"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"twitter-clone.users"},{"v":2,"unique":true,"key":{"EMAIL":1},"name":"EMAIL_1","ns":"twitter-clone.users","background":true}],"uuid":"ab7c9966e0464331acb83fac1246fa5d"} -------------------------------------------------------------------------------- /Interviews/Haptik/Backend Developer/Task 2/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Interviews/Haptik/Backend Developer/Task 2/public/favicon.ico -------------------------------------------------------------------------------- /Interviews/Haptik/Backend Developer/Task 2/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | } 10 | ], 11 | "start_url": ".", 12 | "display": "standalone", 13 | "theme_color": "#000000", 14 | "background_color": "#ffffff" 15 | } 16 | -------------------------------------------------------------------------------- /Interviews/Haptik/Backend Developer/Task 2/src/components/App.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import App from './App'; 4 | 5 | it('renders without crashing', () => { 6 | const div = document.createElement('div'); 7 | ReactDOM.render(, div); 8 | ReactDOM.unmountComponentAtNode(div); 9 | }); 10 | -------------------------------------------------------------------------------- /Interviews/Haptik/Backend Developer/Task 2/src/config.js: -------------------------------------------------------------------------------- 1 | export default { 2 | serverUrl: 'http://localhost:5000/' 3 | } -------------------------------------------------------------------------------- /Interviews/Haptik/Backend Developer/Task 2/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | padding: 0; 4 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", 5 | "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", 6 | sans-serif; 7 | -webkit-font-smoothing: antialiased; 8 | -moz-osx-font-smoothing: grayscale; 9 | } 10 | 11 | code { 12 | font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", 13 | monospace; 14 | } 15 | -------------------------------------------------------------------------------- /Interviews/Toptal/Screen Shot 2019-06-04 at 8.42.41 PM.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Interviews/Toptal/Screen Shot 2019-06-04 at 8.42.41 PM.png -------------------------------------------------------------------------------- /Interviews/Zalando/Frontend Engineer - Distributed Commerce/Screen Shot 2019-08-06 at 11.18.37 PM.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Interviews/Zalando/Frontend Engineer - Distributed Commerce/Screen Shot 2019-08-06 at 11.18.37 PM.png -------------------------------------------------------------------------------- /Interviews/Zalando/Frontend Engineer - Distributed Commerce/Screen Shot 2019-08-07 at 12.18.39 AM.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Interviews/Zalando/Frontend Engineer - Distributed Commerce/Screen Shot 2019-08-07 at 12.18.39 AM.png -------------------------------------------------------------------------------- /Interviews/Zalando/Frontend Engineer - Distributed Commerce/Screen Shot 2019-08-07 at 12.19.41 AM.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Interviews/Zalando/Frontend Engineer - Distributed Commerce/Screen Shot 2019-08-07 at 12.19.41 AM.png -------------------------------------------------------------------------------- /Practice/CodeWars/1-2kyu/Insane Coloured Triangle.js: -------------------------------------------------------------------------------- 1 | const arr = { RR: 'R', BB: 'B', GG: 'G', BG: 'R', BR: 'G', GB: 'R', GR: 'B', RB: 'G', RG: 'B' }; 2 | 3 | function triangle(r) { 4 | while (r.length > 1) { 5 | let n = '', 6 | c = 1; 7 | while (r.length % (3 * c) == 1) c *= 3; 8 | for (let i = 0; i < r.length - 1; i += c) n += arr[r[i] + r[i + c]]; 9 | r = n; 10 | } 11 | return r; 12 | } 13 | -------------------------------------------------------------------------------- /Practice/Codeforces/Increase and Copy-1426C.cpp: -------------------------------------------------------------------------------- 1 | //Problem Link : http://codeforces.com/problemset/problem/1426/C 2 | 3 | #include 4 | using namespace std; 5 | typedef long long ll; 6 | int main() 7 | { 8 | ll t; 9 | cin>>t; 10 | while(t--) 11 | { 12 | ll n,c=0; 13 | cin>>n; 14 | ll m = sqrt(n); 15 | c=m-1; 16 | if(n%m==0) 17 | cout< 4 | using namespace std; 5 | typedef long long ll; 6 | int main() 7 | { 8 | ll n,w=0,i; 9 | cin>>n; 10 | for(i=3;i<=n;i++) 11 | w=w+(i*(i-1)); 12 | cout< 4 | using namespace std; 5 | typedef long long ll; 6 | int main() 7 | { 8 | ll n,a,b,i,y; 9 | cin>>n>>a>>b; 10 | for(i=0;i<=n/a;i++) 11 | { 12 | y = (n-i*a)/b; 13 | if(i*a+y*b==n) 14 | { 15 | cout<<"YES"< 4 | using namespace std; 5 | typedef long long ll; 6 | int main() 7 | { 8 | ll a,b,n,t; 9 | cin>>t; 10 | while(t--) 11 | { 12 | cin>>a>>b>>n; 13 | ll x[3]; 14 | x[0]=a;x[1]=b;x[2]=(a^b); 15 | cout< 4: 9 | ans += str(9 - nn) 10 | else: 11 | ans += str(nn) 12 | print ans 13 | -------------------------------------------------------------------------------- /Practice/Coding Blocks/Competitive Warriors Challenge 1.0/Choosing Numbers.py: -------------------------------------------------------------------------------- 1 | n = int(raw_input()) 2 | print '{0:.2f}'.format(n * 0.09, 2) 3 | -------------------------------------------------------------------------------- /Practice/Coding Blocks/Competitive Warriors Challenge 1.0/Count Set Bits.py: -------------------------------------------------------------------------------- 1 | def answer(n): 2 | count = 0 3 | while n > 0: 4 | n &= n - 1 5 | count += 1 6 | return count 7 | 8 | n = int(raw_input()) 9 | for i in xrange(n): 10 | num = int(raw_input()) 11 | print answer(num) 12 | -------------------------------------------------------------------------------- /Practice/Coding Blocks/Competitive Warriors Challenge 1.0/Count heads.py: -------------------------------------------------------------------------------- 1 | n = int(raw_input()) 2 | print n / 2 3 | -------------------------------------------------------------------------------- /Practice/Coding Blocks/Competitive Warriors Challenge 1.0/Counting Sort.py: -------------------------------------------------------------------------------- 1 | n = int(raw_input()) 2 | data = [int(i) for i in raw_input().split()] 3 | data = sorted(data) 4 | for i in data: 5 | print i, 6 | -------------------------------------------------------------------------------- /Practice/Coding Blocks/Competitive Warriors Challenge 1.0/Dice expectations - 1.py: -------------------------------------------------------------------------------- 1 | print 6 2 | -------------------------------------------------------------------------------- /Practice/Coding Blocks/Competitive Warriors Challenge 1.0/Dice expectations - 2.py: -------------------------------------------------------------------------------- 1 | print 6 2 | -------------------------------------------------------------------------------- /Practice/Coding Blocks/Competitive Warriors Challenge 1.0/Evaluating functions.py: -------------------------------------------------------------------------------- 1 | x = int(raw_input()) 2 | print 4 * x ** 3 + 5 * x ** 2 - 6 * x + 14 3 | -------------------------------------------------------------------------------- /Practice/Coding Blocks/Competitive Warriors Challenge 1.0/GCD.py: -------------------------------------------------------------------------------- 1 | def answer(a, b): 2 | if b == 0: 3 | return a 4 | return answer(b, a % b) 5 | 6 | a = int(raw_input()) 7 | b = int(raw_input()) 8 | print answer(a, b) 9 | -------------------------------------------------------------------------------- /Practice/Coding Blocks/Competitive Warriors Challenge 1.0/Head Expectation.py: -------------------------------------------------------------------------------- 1 | n = int(raw_input()) 2 | print (2 ** (n + 1)) - 2 3 | -------------------------------------------------------------------------------- /Practice/Coding Blocks/Competitive Warriors Challenge 1.0/Incredible Hulk.py: -------------------------------------------------------------------------------- 1 | def answer(n): 2 | count = 0 3 | while n > 0: 4 | n &= n - 1 5 | count += 1 6 | return count 7 | 8 | n = int(raw_input()) 9 | for i in xrange(n): 10 | x = int(raw_input()) 11 | print answer(x) 12 | -------------------------------------------------------------------------------- /Practice/Coding Blocks/Competitive Warriors Challenge 1.0/Interview Candidates.py: -------------------------------------------------------------------------------- 1 | n = 0 2 | ans = 0 3 | while n <= 1.0: 4 | n += (0.84 * ans) 5 | ans += (1 + ans) 6 | print ans 7 | -------------------------------------------------------------------------------- /Practice/Coding Blocks/Competitive Warriors Challenge 1.0/LCM.py: -------------------------------------------------------------------------------- 1 | def answer(a, b): 2 | if b == 0: 3 | return a 4 | return answer(b, a % b) 5 | 6 | a = int(raw_input()) 7 | b = int(raw_input()) 8 | 9 | print (a * b) / answer(a, b) 10 | -------------------------------------------------------------------------------- /Practice/Coding Blocks/Competitive Warriors Challenge 1.0/Probability Coin - 1.py: -------------------------------------------------------------------------------- 1 | print '{0:.2f}'.format(1 / 2.0) 2 | -------------------------------------------------------------------------------- /Practice/Coding Blocks/Competitive Warriors Challenge 1.0/Sanjay's New Job.py: -------------------------------------------------------------------------------- 1 | k = int(raw_input()) 2 | n = int(raw_input()) 3 | ans = [] 4 | for i in xrange(n): 5 | data = [i for i in raw_input().split()] 6 | data[1] = int(data[1]) 7 | if data[1] >= k: 8 | ans.append((data[1], data[0])) 9 | ans = sorted(ans, key=lambda t: (-t[0], t[1])) 10 | for i in ans: 11 | print i[1] + " " + str(i[0]) 12 | -------------------------------------------------------------------------------- /Practice/Coding Blocks/Competitive Warriors Challenge 1.0/Simple HCF.py: -------------------------------------------------------------------------------- 1 | def answer(a, b): 2 | if b == 0: 3 | return a 4 | return answer(b, a % b) 5 | 6 | n = int(raw_input()) 7 | data = [int(i) for i in raw_input().split()] 8 | ans = data[0] 9 | for i in xrange(n-1): 10 | ans = answer(ans, data[i]) 11 | print ans 12 | -------------------------------------------------------------------------------- /Practice/Coding Blocks/Competitive Warriors Challenge 1.0/Simple Input.py: -------------------------------------------------------------------------------- 1 | sum = 0 2 | while 1: 3 | n = int(raw_input()) 4 | sum += n 5 | if sum < 0: 6 | break 7 | print n 8 | -------------------------------------------------------------------------------- /Practice/Coding Blocks/Competitive Warriors Challenge 1.0/Simple factorial.py: -------------------------------------------------------------------------------- 1 | def dpfactorial(n): 2 | fact = 1 3 | dpfact = [1] 4 | for i in xrange(n): 5 | fact *= (i + 1) 6 | fact = fact 7 | dpfact.append(fact) 8 | return dpfact 9 | 10 | dpfact = dpfactorial(21) 11 | n = int(raw_input()) 12 | data = [int(i) for i in raw_input().strip().split()] 13 | sum = 0 14 | for i in xrange(n): 15 | sum += dpfact[data[i]] 16 | print sum % 107 17 | -------------------------------------------------------------------------------- /Practice/Coding Blocks/Competitive Warriors Challenge 1.0/String Sort.py: -------------------------------------------------------------------------------- 1 | n = int(raw_input()) 2 | ans = [] 3 | for i in xrange(n): 4 | data = raw_input() 5 | ans.append(data) 6 | ans = sorted(ans) 7 | for i in xrange(n-1): 8 | if (ans[i].find(ans[i+1]) or ans[i+1].find(ans[i])) and len(ans[i+1]) > len(ans[i]): 9 | temp = ans[i] 10 | ans[i] = ans[i+1] 11 | ans[i+1] = temp 12 | for i in ans: 13 | print i 14 | -------------------------------------------------------------------------------- /Practice/Coding Blocks/Competitive Warriors Challenge 1.0/Success Expectation.py: -------------------------------------------------------------------------------- 1 | data = [i for i in raw_input().split()] 2 | print int(int(data[0]) / float(data[1])) 3 | -------------------------------------------------------------------------------- /Practice/Coding Blocks/Competitive Warriors Challenge 1.0/Unique Numbers - II.py: -------------------------------------------------------------------------------- 1 | n = int(raw_input()) 2 | data = [int(i) for i in raw_input().split()] 3 | data = sorted(data) 4 | ans = 0 5 | for i in xrange(0, n, 2): 6 | if data[i] != data[i + 1]: 7 | print str(data[i]), 8 | i -= 1 9 | ans += 1 10 | if ans != 2: 11 | print str(data[n-1]) + " ", 12 | -------------------------------------------------------------------------------- /Practice/Coding Blocks/Competitive Warriors Challenge 1.0/Virat and Factorials.py: -------------------------------------------------------------------------------- 1 | def factorial(n): 2 | if n <= 1: 3 | return 1 4 | else: 5 | return n * factorial(n-1) 6 | n = int(raw_input()) 7 | print factorial(n) 8 | 9 | -------------------------------------------------------------------------------- /Practice/Coding Blocks/Competitive Warriors Challenge 1.0/Virat and nCr.py: -------------------------------------------------------------------------------- 1 | def factorial(n, k): 2 | if n == 1: 3 | return 1 4 | if n == k: 5 | return 1 6 | return n * factorial(n - 1, k) 7 | data = [int(i) for i in raw_input().split()] 8 | data[1] = max(data[1], data[0] - data[1]) 9 | print (factorial(data[0], data[1]) / factorial(data[0]-data[1], 1)) % 1000000007 10 | -------------------------------------------------------------------------------- /Practice/Coding Blocks/Competitive Warriors Challenge 3.0/Are They Same.py: -------------------------------------------------------------------------------- 1 | def answer(s): 2 | if len(s) % 2 == 1: 3 | return s 4 | s1 = answer(s[:len(s)/2]) 5 | s2 = answer(s[len(s)/2:]) 6 | if s1 < s2: 7 | return s1 + s2 8 | return s2 + s1 9 | 10 | t = int(raw_input()) 11 | for i in xrange(t): 12 | s1 = raw_input() 13 | s2 = raw_input() 14 | if answer(s1) == answer(s2): 15 | print "YES" 16 | else: 17 | print "NO" 18 | -------------------------------------------------------------------------------- /Practice/Coding Blocks/Competitive Warriors Challenge 3.0/Find Upper and Lower bound.py: -------------------------------------------------------------------------------- 1 | n = int(raw_input()) 2 | data = [int(i) for i in raw_input().split()] 3 | q = int(raw_input()) 4 | for i in xrange(q): 5 | x = int(raw_input()) 6 | if x in data: 7 | print data.index(x), 8 | print len(data) - 1 - data[::-1].index(x) 9 | else: 10 | print -1, 11 | print -1 12 | -------------------------------------------------------------------------------- /Practice/Coding Blocks/Competitive Warriors Challenge 3.0/HELP RAHUL TO SEARCH.py: -------------------------------------------------------------------------------- 1 | n = int(raw_input()) 2 | data = [] 3 | for i in xrange(n): 4 | data.append(int(raw_input())) 5 | x = int(raw_input()) 6 | if x in data: 7 | print len(data) - 1 - data[::-1].index(x) 8 | else: 9 | print -1 10 | -------------------------------------------------------------------------------- /Practice/Coding Blocks/Competitive Warriors Challenge 3.0/Maximum Subarray Sum (Divide and Conquer).py: -------------------------------------------------------------------------------- 1 | def answer(data): 2 | m = data[0] 3 | mm = data[0] 4 | for x in data[1:]: 5 | m = max(x, m + x) 6 | mm = max(m, mm) 7 | return mm 8 | t = int(raw_input()) 9 | for i in xrange(t): 10 | n = int(raw_input()) 11 | data = [int(i) for i in raw_input().split()] 12 | print answer(data) 13 | -------------------------------------------------------------------------------- /Practice/Coding Blocks/Competitive Warriors Challenge 3.0/Multiples Again.py: -------------------------------------------------------------------------------- 1 | def answer(a, b): 2 | if b == 0: 3 | return a 4 | return answer(b, a % b) 5 | 6 | t = int(raw_input()) 7 | for i in xrange(t): 8 | data = [int(j) for j in raw_input().split()] 9 | ans = (data[0] * data[1]) / answer(data[0], data[1]) 10 | print data[2] / ans 11 | -------------------------------------------------------------------------------- /Practice/Coding Blocks/Competitive Warriors Challenge 3.0/Play The Game.py: -------------------------------------------------------------------------------- 1 | def count(n): 2 | ans = 0 3 | while n % 2 == 0: 4 | n /= 2 5 | ans += 1 6 | return ans 7 | t = int(raw_input()) 8 | for i in xrange(t): 9 | n = int(raw_input()) 10 | data = [int(j) for j in raw_input().split()] 11 | ans = 0 12 | for j in xrange(n): 13 | ans += count(data[j]) 14 | if ans % 2 == 0: 15 | print 'Alan' 16 | else: 17 | print 'Charlie' 18 | -------------------------------------------------------------------------------- /Practice/Coding Blocks/Competitive Warriors Challenge 3.0/Rearrange.py: -------------------------------------------------------------------------------- 1 | n = int(raw_input()) 2 | data = [int(i) for i in raw_input().split()] 3 | for i in xrange(0, n / 2, 2): 4 | temp = data[i] 5 | data[i] = data[n - i - 1] 6 | data[n - i - 1] = temp 7 | for i in data: 8 | print i, 9 | -------------------------------------------------------------------------------- /Practice/Coding Blocks/Competitive Warriors Challenge 3.0/Simple Enough.py: -------------------------------------------------------------------------------- 1 | def answer(n): 2 | if n == 0: 3 | return 0 4 | elif n == 1: 5 | return 1 6 | else: 7 | s = str(answer(n / 2)) 8 | return s + str(n % 2) + s 9 | data = [int(i) for i in raw_input().split()] 10 | text = answer(data[0]) 11 | ans = 0 12 | for i in xrange(data[1] - 1, data[2]): 13 | if text[i] == '1': 14 | ans += 1 15 | print ans 16 | -------------------------------------------------------------------------------- /Practice/Coding Blocks/Competitive Warriors Challenge 3.0/Uncommon.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() 4 | { 5 | string a,b; 6 | cin >> a >> b; 7 | if (a==b) 8 | cout << -1; 9 | else 10 | cout << max(a.size(),b.size()); 11 | } 12 | -------------------------------------------------------------------------------- /Practice/Coding Blocks/Competitive Warriors Challenge 3.0/Uncommon.py: -------------------------------------------------------------------------------- 1 | a = raw_input().strip() 2 | b = raw_input().strip() 3 | if a == b: 4 | print -1 5 | else: 6 | print max(len(a), len(b)) 7 | -------------------------------------------------------------------------------- /Practice/Coding Blocks/Competitive Warriors Challenge 3.0/Vivek and Factors.py: -------------------------------------------------------------------------------- 1 | dp = [0] * (100001) 2 | for i in xrange(1, 100001): 3 | for j in xrange(i, 100001, i): 4 | dp[j] += i 5 | 6 | n = int(raw_input()) 7 | 8 | while n != 0: 9 | ans = -1 10 | if n in dp: 11 | ans = len(dp) - 1 - dp[::-1].index(n) 12 | print ans 13 | n = int(raw_input()) 14 | -------------------------------------------------------------------------------- /Practice/Coding Blocks/Competitive Warriors Challenge 4.0/Generate Parentheses.py: -------------------------------------------------------------------------------- 1 | def printans(s, n, o, c): 2 | if c == n: 3 | print s 4 | return 5 | 6 | if o > c: 7 | printans(s + ')', n, o, c + 1) 8 | if o < n: 9 | printans(s + '(', n, o + 1, c) 10 | 11 | 12 | n = int(raw_input()) 13 | printans('', n, 0, 0) 14 | -------------------------------------------------------------------------------- /Practice/Coding Blocks/Competitive Warriors Challenge 4.0/Recursion-Subsequences.py: -------------------------------------------------------------------------------- 1 | ans = [] 2 | text = raw_input().strip() 3 | def subsequence(instr, outstr, i): 4 | if len(instr) == i: 5 | ans.append(outstr) 6 | return 7 | 8 | outstr += instr[i] 9 | subsequence(instr, outstr, i + 1) 10 | subsequence(instr, outstr[:-1], i + 1) 11 | 12 | 13 | print 2 ** len(text) 14 | subsequence(text, "", 0) 15 | ans.reverse() 16 | for x in ans: 17 | print x, 18 | -------------------------------------------------------------------------------- /Practice/Coding Blocks/Competitive Warriors Challenge 4.0/Recursion-Tower of Hanoi.py: -------------------------------------------------------------------------------- 1 | def answer(n, src, dest, helper): 2 | if n == 1: 3 | print "Move " + str(n) + "th disc from " + src + " to " + dest 4 | return 5 | 6 | answer(n - 1, src, helper, dest) 7 | print "Move " + str(n) + "th disc from " + src + " to " + dest 8 | answer(n - 1, helper, dest, src) 9 | n = int(raw_input()) 10 | answer(n, 'T1', 'T2', 'T3') 11 | print 2 ** n - 1 12 | -------------------------------------------------------------------------------- /Practice/Coding Blocks/Game Theory Hackathon/GAME THEORY - 1.py: -------------------------------------------------------------------------------- 1 | t = int(raw_input()) 2 | for i in xrange(t): 3 | data = [int(j) for j in raw_input().split()] 4 | n = data[0] 5 | m = data[1] 6 | if n % 2 == 0: 7 | print "2" 8 | else: 9 | print "1" -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00001/README.md: -------------------------------------------------------------------------------- 1 | # Problem 1 2 | 3 | Given a list of numbers, return whether any two sums to k. 4 | 5 | For example, given [10, 15, 3, 7] and k of 17, return true since 10 + 7 is 17. 6 | 7 | Bonus: Can you do this in one pass? -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00002/solution.py: -------------------------------------------------------------------------------- 1 | l=list(map(int,input("Enter The Numbers").split())) 2 | h=[] 3 | for o in l: 4 | s=1 5 | for i in range(0,len(l)): 6 | if o==l[i]: 7 | continue 8 | else: 9 | s=s*l[i] 10 | h.append(s) 11 | -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00003/README.md: -------------------------------------------------------------------------------- 1 | # Problem 3 2 | This problem was asked by Google. 3 | 4 | Given the root to a binary tree, implement serialize(root), which serializes the tree into a string, and deserialize(s), which deserializes the string back into the tree. 5 | -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00004/README.md: -------------------------------------------------------------------------------- 1 | # Problem 4 2 | 3 | This problem was asked by Stripe. 4 | 5 | Given an array of integers, find the first missing positive integer in linear time and constant space. In other words, find the lowest positive integer that does not exist in the array. The array can contain duplicates and negative numbers as well. 6 | 7 | For example, the input [3, 4, -1, 1] should give 2. The input [1, 2, 0] should give 3. 8 | 9 | You can modify the input array in-place. 10 | -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00005/README.md: -------------------------------------------------------------------------------- 1 | # Problem 5 2 | 3 | This problem was asked by Jane Street. 4 | 5 | cons(a, b) constructs a pair, and car(pair) and cdr(pair) returns the first and last element of that pair. For example, car(cons(3, 4)) returns 3, and cdr(cons(3, 4)) returns 4. 6 | 7 | Given this implementation of cons: 8 | 9 | def cons(a, b): 10 | return lambda f : f(a, b) 11 | 12 | Implement car and cdr. 13 | -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00007/README.md: -------------------------------------------------------------------------------- 1 | # Problem 7 2 | 3 | This problem was asked by Facebook. 4 | 5 | Given the mapping a = 1, b = 2, ... z = 26, and an encoded message, count the number of ways it can be decoded. 6 | 7 | For example, the message '111' would give 3, since it could be decoded as 'aaa', 'ka', and 'ak'. 8 | 9 | You can assume that the messages are decodable. For example, '001' is not allowed. 10 | -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00008/README.md: -------------------------------------------------------------------------------- 1 | # Problem 8 2 | 3 | This problem is as follows 4 | 5 | Given an array of size n and a number K. 6 | Find whether there are any 2 numbers in K whose sum add up to K. 7 | 8 | -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00218/README.md: -------------------------------------------------------------------------------- 1 | # Problem 218 2 | 3 | This problem was asked by Yahoo. 4 | 5 | Write an algorithm that computes the reversal of a directed graph. For example, if a graph consists of A -> B -> C, it should become A <- B <- C. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00219/README.md: -------------------------------------------------------------------------------- 1 | # Problem 219 2 | 3 | This problem was asked by Salesforce. 4 | 5 | Connect 4 is a game where opponents take turns dropping red or black discs into a 7 x 6 vertically suspended grid. The game ends either when one player creates a line of four consecutive discs of their color (horizontally, vertically, or diagonally), or when there are no more spots left in the grid. 6 | 7 | Design and implement Connect 4. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00221/README.md: -------------------------------------------------------------------------------- 1 | # Problem 221 2 | 3 | This problem was asked by Zillow. 4 | 5 | Let's define a "sevenish" number to be one which is either a power of 7, or the sum of unique powers of 7. The first few sevenish numbers are 1, 7, 8, 49, and so on. Create an algorithm to find the nth sevenish number. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00222/README.md: -------------------------------------------------------------------------------- 1 | # Problem 222 2 | 3 | This problem was asked by Quora. 4 | 5 | Given an absolute pathname that may have . or .. as part of it, return the shortest standardized path. 6 | 7 | For example, given "/usr/bin/../bin/./scripts/../", return "/usr/bin/". -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00223/README.md: -------------------------------------------------------------------------------- 1 | # Problem 223 2 | 3 | This problem was asked by Palantir. 4 | 5 | Typically, an implementation of in-order traversal of a binary tree has O(h) space complexity, where h is the height of the tree. Write a program to compute the in-order traversal of a binary tree using O(1) space. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00224/README.md: -------------------------------------------------------------------------------- 1 | # Problem 224 2 | 3 | This problem was asked by Amazon. 4 | 5 | Given a sorted array, find the smallest positive integer that is not the sum of a subset of the array. 6 | 7 | For example, for the input [1, 2, 3, 10], you should return 7. 8 | 9 | Do this in O(N) time. 10 | -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00226/README.md: -------------------------------------------------------------------------------- 1 | # Problem 226 2 | 3 | This problem was asked by Airbnb. 4 | 5 | You come across a dictionary of sorted words in a language you've never seen before. Write a program that returns the correct order of letters in this language. 6 | 7 | For example, given ['xww', 'wxyz', 'wxyw', 'ywx', 'ywz'], you should return ['x', 'z', 'w', 'y']. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00227/README.md: -------------------------------------------------------------------------------- 1 | # Problem 227 2 | 3 | This problem was asked by Facebook. 4 | 5 | Boggle is a game played on a 4 x 4 grid of letters. The goal is to find as many words as possible that can be formed by a sequence of adjacent letters in the grid, using each cell at most once. Given a game board and a dictionary of valid words, implement a Boggle solver. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00228/README.md: -------------------------------------------------------------------------------- 1 | # Problem 228 2 | 3 | This problem was asked by Twitter. 4 | 5 | Given a list of numbers, create an algorithm that arranges them in order to form the largest possible integer. For example, given [10, 7, 76, 415], you should return 77641510. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00231/README.md: -------------------------------------------------------------------------------- 1 | # Problem 231 2 | 3 | This problem was asked by IBM. 4 | 5 | Given a string with repeated characters, rearrange the string so that no two adjacent characters are the same. If this is not possible, return None. 6 | 7 | For example, given "aaabbc", you could return "ababac". Given "aaab", return None. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00233/README.md: -------------------------------------------------------------------------------- 1 | # Problem 233 2 | 3 | This problem was asked by Apple. 4 | 5 | Implement the function fib(n), which returns the nth number in the Fibonacci sequence, using only O(1) space. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00233/solution.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | typedef long long ll; 6 | 7 | ll fib(ll n){ 8 | ll a=1, b=1; 9 | ll temp; 10 | for(int i=1; i>n; 25 | cout< 4 -> -7 -> 5 -> -6 -> 6. In this case, you should first remove 3 -> 4 -> -7, then -6 -> 6, leaving only 5. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00419/README.md: -------------------------------------------------------------------------------- 1 | # Problem #419 [Easy] 2 | 3 | This problem was asked by PagerDuty. 4 | 5 | Given a positive integer N, find the smallest number of steps it will take to reach 1. 6 | 7 | There are two kinds of permitted steps: 8 | 9 | - You may decrement N to N - 1. 10 | - If a * b = N, you may decrement N to the larger of a and b. 11 | 12 | For example, given 100, you can reach 1 in five steps with the following route: 100 -> 10 -> 9 -> 3 -> 2 -> 1. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00420/README.md: -------------------------------------------------------------------------------- 1 | # Problem #420 [Easy] 2 | 3 | This problem was asked by Microsoft. 4 | 5 | A number is considered perfect if its digits sum up to exactly 10. 6 | 7 | Given a positive integer n, return the n-th perfect number. 8 | 9 | For example, given 1, you should return 19. Given 2, you should return 28. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00421/README.md: -------------------------------------------------------------------------------- 1 | # Problem #421 [Medium] 2 | 3 | This problem was asked by Amazon. 4 | 5 | Given an array of a million integers between zero and a billion, out of order, how can you efficiently sort it? Assume that you cannot store an array of a billion elements in memory. 6 | 7 | -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00422/README.md: -------------------------------------------------------------------------------- 1 | # Problem #422 [Easy] 2 | 3 | This problem was asked by Salesforce. 4 | 5 | Write a program to merge two binary trees. Each node in the new tree should hold a value equal to the sum of the values of the corresponding nodes of the input trees. 6 | 7 | If only one input tree has a node in a given position, the corresponding node in the new tree should match that input node. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00424/README.md: -------------------------------------------------------------------------------- 1 | # Problem #424 [Medium] 2 | 3 | This problem was asked by Facebook. 4 | 5 | Given an array of integers in which two elements appear exactly once and all other elements appear exactly twice, find the two elements that appear only once. 6 | 7 | For example, given the array [2, 4, 6, 8, 10, 2, 6, 10], return 4 and 8. The order does not matter. 8 | 9 | Follow-up: Can you do this in linear time and constant space? -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00426/README.md: -------------------------------------------------------------------------------- 1 | # Problem #426 [Easy] 2 | 3 | This problem was asked by Facebook. 4 | 5 | Given a binary tree, return the level of the tree with minimum sum. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00430/README.md: -------------------------------------------------------------------------------- 1 | # Problem #430 [Hard] 2 | 3 | This problem was asked by Facebook. 4 | 5 | Given a string of parentheses, find the balanced string that can be produced from it using the minimum number of insertions and deletions. If there are multiple solutions, return any of them. 6 | 7 | For example, given "(()", you could return "(())". Given "))()(", you could return "()()()()". -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00433/README.md: -------------------------------------------------------------------------------- 1 | # Problem #433 [Medium] 2 | 3 | This problem was asked by Facebook. 4 | 5 | Given an integer n, find the next biggest integer with the same number of 1-bits on. For example, given the number 6 (0110 in binary), return 9 (1001). -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00434/README.md: -------------------------------------------------------------------------------- 1 | # Problem #434 [Easy] 2 | 3 | This problem was asked by Oracle. 4 | 5 | Given a binary search tree, find the floor and ceiling of a given integer. The floor is the highest element in the tree less than or equal to an integer, while the ceiling is the lowest element in the tree greater than or equal to an integer. 6 | 7 | If either value does not exist, return None. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00436/README.md: -------------------------------------------------------------------------------- 1 | # Problem #436 [Hard] 2 | 3 | This problem was asked by Microsoft. 4 | 5 | Implement 3 stacks using a single list: 6 | ``` 7 | class Stack: 8 | def __init__(self): 9 | self.list = [] 10 | 11 | def pop(self, stack_number): 12 | pass 13 | 14 | def push(self, item, stack_number): 15 | pass 16 | ``` -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00437/README.md: -------------------------------------------------------------------------------- 1 | # Problem #437 [Medium] 2 | 3 | This problem was asked by Square. 4 | 5 | Given a string and a set of characters, return the shortest substring containing all the characters in the set. 6 | 7 | For example, given the string "figehaeci" and the set of characters {a, e, i}, you should return "aeci". 8 | 9 | If there is no substring containing all the characters in the set, return null. 10 | 11 | -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00440/README.md: -------------------------------------------------------------------------------- 1 | # Problem #440 [Medium] 2 | 3 | This problem was asked by Microsoft. 4 | 5 | Describe and give an example of each of the following types of polymorphism: 6 | 7 | - Ad-hoc polymorphism 8 | - Parametric polymorphism 9 | - Subtype polymorphism -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00443/README.md: -------------------------------------------------------------------------------- 1 | # Problem #443 [Medium] 2 | 3 | This problem was asked by Apple. 4 | 5 | Implement a queue using two stacks. Recall that a queue is a FIFO (first-in, first-out) data structure with the following methods: enqueue, which inserts an element into the queue, and dequeue, which removes it. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00444/README.md: -------------------------------------------------------------------------------- 1 | # Problem #444 [Hard] 2 | 3 | This problem was asked by Dropbox. 4 | 5 | Implement an efficient string matching algorithm. 6 | 7 | That is, given a string of length N and a pattern of length k, write a program that searches for the pattern in the string with less than O(N * k) worst-case time complexity. 8 | 9 | If the pattern is found, return the start index of its location. If not, return False. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00446/README.md: -------------------------------------------------------------------------------- 1 | # Problem #446 [Medium] 2 | 3 | This problem was asked by Indeed. 4 | 5 | Given a 32-bit positive integer N, determine whether it is a power of four in faster than O(log N) time. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00447/README.md: -------------------------------------------------------------------------------- 1 | # Problem #447 [Medium] 2 | 3 | This problem was asked by Google. 4 | 5 | Implement integer exponentiation. That is, implement the pow(x, y) function, where x and y are integers and returns x^y. 6 | 7 | Do this faster than the naive method of repeated multiplication. 8 | 9 | For example, pow(2, 10) should return 1024. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00448/README.md: -------------------------------------------------------------------------------- 1 | # Problem #448 [Hard] 2 | 3 | This problem was asked by Google. 4 | 5 | Given an array of strictly the characters 'R', 'G', and 'B', segregate the values of the array so that all the Rs come first, the Gs come second, and the Bs come last. You can only swap elements of the array. 6 | 7 | Do this in linear time and in-place. 8 | 9 | For example, given the array ['G', 'B', 'R', 'R', 'B', 'R', 'G'], it should become ['R', 'R', 'R', 'G', 'G', 'B', 'B']. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00450/README.md: -------------------------------------------------------------------------------- 1 | # Problem #450 [Hard] 2 | 3 | This problem was asked by Google. 4 | 5 | You're given a string consisting solely of (, ), and *. * can represent either a (, ), or an empty string. Determine whether the parentheses are balanced. 6 | 7 | For example, (()* and (*) are balanced. )*( is not balanced. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00451/README.md: -------------------------------------------------------------------------------- 1 | # Problem #451 [Easy] 2 | 3 | This problem was asked by Apple. 4 | 5 | Implement the function fib(n), which returns the nth number in the Fibonacci sequence, using only O(1) space. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00453/README.md: -------------------------------------------------------------------------------- 1 | # Problem #453 [Easy] 2 | 3 | This problem was asked by Google. 4 | 5 | Given the root of a binary search tree, and a target K, return two nodes in the tree whose sum equals K. 6 | 7 | For example, given the following tree and K of 20 8 | ``` 9 | 10 10 | / \ 11 | 5 15 12 | / \ 13 | 11 15 14 | ``` 15 | Return the nodes 5 and 15. 16 | 17 | -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00454/README.md: -------------------------------------------------------------------------------- 1 | # Problem #454 [Medium] 2 | 3 | This problem was asked by Facebook. 4 | 5 | Describe an algorithm to compute the longest increasing subsequence of an array of numbers in O(n log n) time. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00457/README.md: -------------------------------------------------------------------------------- 1 | # Problem #457 [Hard] 2 | 3 | This problem was asked by Google. 4 | 5 | Given a word W and a string S, find all starting indices in S which are anagrams of W. 6 | 7 | For example, given that W is "ab", and S is "abxaba", return 0, 3, and 4. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00459/README.md: -------------------------------------------------------------------------------- 1 | # Problem #459 [Medium] 2 | 3 | This problem was asked by Uber. 4 | 5 | Write a program that determines the smallest number of perfect squares that sum up to N. 6 | 7 | Here are a few examples: 8 | 9 | - Given N = 4, return 1 (4) 10 | - Given N = 17, return 2 (16 + 1) 11 | - Given N = 18, return 2 (9 + 9) -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00462/README.md: -------------------------------------------------------------------------------- 1 | # Problem #462 [Hard] 2 | 3 | This problem was asked by Oracle. 4 | 5 | We say a number is sparse if there are no adjacent ones in its binary representation. For example, 21 (10101) is sparse, but 22 (10110) is not. For a given input N, find the smallest sparse number greater than or equal to N. 6 | 7 | Do this in faster than O(N log N) time. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00464/README.md: -------------------------------------------------------------------------------- 1 | # Problem #464 [Medium] 2 | 3 | This problem was asked by Google. 4 | 5 | Given a set of distinct positive integers, find the largest subset such that every pair of elements in the subset (i, j) satisfies either i % j = 0 or j % i = 0. 6 | 7 | For example, given the set [3, 5, 10, 20, 21], you should return [5, 10, 20]. Given [1, 3, 6, 24], return [1, 3, 6, 24]. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00465/README.md: -------------------------------------------------------------------------------- 1 | # Problem #465 [Easy] 2 | 3 | This problem was asked by Google. 4 | 5 | Given the head of a singly linked list, reverse it in-place. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00466/README.md: -------------------------------------------------------------------------------- 1 | # Problem #466 [Easy] 2 | 3 | This problem was asked by Amazon. 4 | 5 | A tree is symmetric if its data and shape remain unchanged when it is reflected about the root node. The following tree is an example: 6 | 7 | ``` 8 | 4 9 | / | \ 10 | 3 5 3 11 | / \ 12 | 9 9 13 | ``` 14 | Given a k-ary tree, determine whether it is symmetric. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00467/README.md: -------------------------------------------------------------------------------- 1 | # Problem #467 [Medium] 2 | 3 | Given a real number n, find the square root of n. For example, given n = 9, return 3. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00468/README.md: -------------------------------------------------------------------------------- 1 | # Problem #468 [Medium] 2 | 3 | This problem was asked by Facebook. 4 | 5 | Given an N by N matrix, rotate it by 90 degrees clockwise. 6 | 7 | For example, given the following matrix: 8 | ``` 9 | [[1, 2, 3], 10 | [4, 5, 6], 11 | [7, 8, 9]] 12 | ``` 13 | you should return: 14 | ``` 15 | [[7, 4, 1], 16 | [8, 5, 2], 17 | [9, 6, 3]] 18 | ``` 19 | Follow-up: What if you couldn't use any extra space? -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00471/README.md: -------------------------------------------------------------------------------- 1 | # Problem #471 [Easy] 2 | 3 | This problem was asked by Amazon. 4 | 5 | Given an integer N, construct all possible binary search trees with N nodes. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00472/README.md: -------------------------------------------------------------------------------- 1 | # Problem #472 [Medium] 2 | 3 | This problem was asked by Facebook. 4 | 5 | Given the mapping a = 1, b = 2, ... z = 26, and an encoded message, count the number of ways it can be decoded. 6 | 7 | For example, the message '111' would give 3, since it could be decoded as 'aaa', 'ka', and 'ak'. 8 | 9 | You can assume that the messages are decodable. For example, '001' is not allowed. 10 | 11 | -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00473/README.md: -------------------------------------------------------------------------------- 1 | # Problem #473 [Medium] 2 | 3 | This problem was asked by Yahoo. 4 | 5 | Write an algorithm that computes the reversal of a directed graph. For example, if a graph consists of A -> B -> C, it should become A <- B <- C. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00474/README.md: -------------------------------------------------------------------------------- 1 | # Problem #474 [Hard] 2 | 3 | This problem was asked by Google. 4 | 5 | Find the minimum number of coins required to make n cents. 6 | 7 | You can use standard American denominations, that is, 1¢, 5¢, 10¢, and 25¢. 8 | 9 | For example, given n = 16, return 3 since we can make it with a 10¢, a 5¢, and a 1¢. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00476/README.md: -------------------------------------------------------------------------------- 1 | # Problem #476 [Medium] 2 | 3 | This problem was asked by Google. 4 | 5 | You are given an array of length n + 1 whose elements belong to the set {1, 2, ..., n}. By the pigeonhole principle, there must be a duplicate. Find it in linear time and space. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00477/README.md: -------------------------------------------------------------------------------- 1 | # Problem #477 [Easy] 2 | 3 | This problem was asked by Dropbox. 4 | 5 | What does the below code snippet print out? How can we fix the anonymous functions to behave as we'd expect? 6 | ``` 7 | functions = [] 8 | for i in range(10): 9 | functions.append(lambda : i) 10 | 11 | for f in functions: 12 | print(f()) 13 | ``` -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00478/README.md: -------------------------------------------------------------------------------- 1 | # Problem #478 [Hard] 2 | 3 | This problem was asked by Google. 4 | 5 | Implement a file syncing algorithm for two computers over a low-bandwidth network. What if we know the files in the two computers are mostly the same? -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00479/README.md: -------------------------------------------------------------------------------- 1 | # Problem #479 [Easy] 2 | 3 | This problem was asked by Microsoft. 4 | 5 | Given a number in the form of a list of digits, return all possible permutations. 6 | 7 | For example, given [1,2,3], return [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00482/README.md: -------------------------------------------------------------------------------- 1 | # Problem #482 [Medium] 2 | 3 | This problem was asked by Google. 4 | 5 | Given a binary search tree and a range [a, b] (inclusive), return the sum of the elements of the binary search tree within the range. 6 | 7 | For example, given the following tree: 8 | ``` 9 | 5 10 | / \ 11 | 3 8 12 | / \ / \ 13 | 2 4 6 10 14 | ``` 15 | and the range [4, 9], return 23 (5 + 4 + 6 + 8). -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00484/README.md: -------------------------------------------------------------------------------- 1 | # Problem #484 [Medium] 2 | 3 | This problem was asked by Dropbox. 4 | 5 | Given the root to a binary search tree, find the second largest node in the tree. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00485/README.md: -------------------------------------------------------------------------------- 1 | # Problem #485 [Hard] 2 | 3 | This problem was asked by Amazon. 4 | 5 | Given an integer k and a string s, find the length of the longest substring that contains at most k distinct characters. 6 | 7 | For example, given s = "abcba" and k = 2, the longest substring with k distinct characters is "bcb". -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00486/README.md: -------------------------------------------------------------------------------- 1 | # Problem #486 [Medium] 2 | 3 | This problem was asked by Pinterest. 4 | 5 | At a party, there is a single person who everyone knows, but who does not know anyone in return (the "celebrity"). To help figure out who this is, you have access to an O(1) method called knows(a, b), which returns True if person a knows person b, else False. 6 | 7 | Given a list of N people and the above operation, find a way to identify the celebrity in O(N) time. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00487/README.md: -------------------------------------------------------------------------------- 1 | # Problem #487 [Medium] 2 | 3 | This problem was asked by Yext. 4 | 5 | Two nodes in a binary tree can be called cousins if they are on the same level of the tree but have different parents. For example, in the following diagram 4 and 6 are cousins. 6 | 7 | ``` 8 | 1 9 | / \ 10 | 2 3 11 | / \ \ 12 | 4 5 6 13 | ``` 14 | 15 | Given a binary tree and a particular node, find all cousins of that node. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00488/README.md: -------------------------------------------------------------------------------- 1 | # Problem #488 [Hard] 2 | 3 | This problem was asked by Netflix. 4 | 5 | Implement a queue using a set of fixed-length arrays. 6 | 7 | The queue should support enqueue, dequeue, and get_size operations. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00489/README.md: -------------------------------------------------------------------------------- 1 | # Problem #489 [Easy] 2 | 3 | This problem was asked by Google. 4 | 5 | Given an array of elements, return the length of the longest subarray where all its elements are distinct. 6 | 7 | For example, given the array [5, 1, 3, 5, 2, 3, 4, 1], return 5 as the longest subarray of distinct elements is [5, 2, 3, 4, 1]. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00491/README.md: -------------------------------------------------------------------------------- 1 | # Problem #491 [Easy] 2 | 3 | This problem was asked by Palantir. 4 | 5 | Write a program that checks whether an integer is a palindrome. For example, 121 is a palindrome, as well as 888. 678 is not a palindrome. Do not convert the integer into a string. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00492/README.md: -------------------------------------------------------------------------------- 1 | # Problem #492 [Medium] 2 | 3 | This problem was asked by Google. 4 | 5 | Given an undirected graph represented as an adjacency matrix and an integer k, write a function to determine whether each vertex in the graph can be colored such that no two adjacent vertices share the same color using at most k colors. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00494/README.md: -------------------------------------------------------------------------------- 1 | # Problem #494 [Medium] 2 | 3 | This problem was asked by Facebook. 4 | 5 | Given a circular array, compute its maximum subarray sum in O(n) time. A subarray can be empty, and in this case the sum is 0. 6 | 7 | For example, given [8, -1, 3, 4], return 15 as we choose the numbers 3, 4, and 8 where the 8 is obtained from wrapping around. 8 | 9 | Given [-4, 5, 1, 0], return 6 as we choose the numbers 5 and 1. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00495/README.md: -------------------------------------------------------------------------------- 1 | # Problem #495 [Medium] 2 | 3 | This problem was asked by Facebook. 4 | 5 | Given a stream of elements too large to store in memory, pick a random element from the stream with uniform probability. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00496/README.md: -------------------------------------------------------------------------------- 1 | # Problem #496 [Easy] 2 | 3 | This problem was asked by Pivotal. 4 | 5 | Write an algorithm that finds the total number of set bits in all integers between 1 and N. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00498/README.md: -------------------------------------------------------------------------------- 1 | # Problem #498 [Easy] 2 | 3 | This problem was asked by WhatsApp. 4 | 5 | Given an array of integers out of order, determine the bounds of the smallest window that must be sorted in order for the entire array to be sorted. For example, given [3, 7, 5, 6, 9], you should return (1, 3). -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00501/README.md: -------------------------------------------------------------------------------- 1 | # Problem #501 [Medium] 2 | 3 | This problem was asked by Facebook. 4 | 5 | Given a function that generates perfectly random numbers between 1 and k (inclusive), where k is an input, write a function that shuffles a deck of cards represented as an array using only swaps. 6 | 7 | It should run in O(N) time. 8 | 9 | Hint: Make sure each one of the 52! permutations of the deck is equally likely. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00502/README.md: -------------------------------------------------------------------------------- 1 | # Problem #502 [Easy] 2 | 3 | This problem was asked by PayPal. 4 | 5 | Given a binary tree, determine whether or not it is height-balanced. A height-balanced binary tree can be defined as one in which the heights of the two subtrees of any node never differ by more than one. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00503/README.md: -------------------------------------------------------------------------------- 1 | # Problem 253 2 | This problem was asked by PayPal. 3 | 4 | Given a string and a number of lines k, print the string in zigzag form. In zigzag, characters are printed out diagonally from top left to bottom right until reaching the kth line, then back up to top right, and so on. 5 | 6 | For example, given the sentence "thisisazigzag" and k = 4, you should print: 7 | 8 | t a g 9 | h s z a 10 | i i i z 11 | s g -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00504/README.md: -------------------------------------------------------------------------------- 1 | # Problem #503 [Medium] 2 | 3 | This problem was asked by Google. 4 | 5 | Given a linked list, sort it in O(n log n) time and constant space. 6 | 7 | For example, the linked list 4 -> 1 -> -3 -> 99 should become -3 -> 1 -> 4 -> 99. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00505/README.md: -------------------------------------------------------------------------------- 1 | # Problem #505 [Easy] 2 | 3 | This problem was asked by Amazon. 4 | 5 | Given an array and a number k that's smaller than the length of the array, rotate the array to the right k elements in-place. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00506/README.md: -------------------------------------------------------------------------------- 1 | # Problem #506 [Medium] 2 | 3 | This problem was asked by Fitbit. 4 | 5 | Given a linked list, rearrange the node values such that they appear in alternating low -> high -> low -> high ... form. For example, given 1 -> 2 -> 3 -> 4 -> 5, you should return 1 -> 3 -> 2 -> 5 -> 4. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00507/README.md: -------------------------------------------------------------------------------- 1 | # Problem #507 [Easy] 2 | 3 | This problem was asked by Uber. 4 | 5 | On election day, a voting machine writes data in the form (voter_id, candidate_id) to a text file. Write a program that reads this file as a stream and returns the top 3 candidates at any given time. If you find a voter voting more than once, report this as fraud. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00508/README.md: -------------------------------------------------------------------------------- 1 | # Problem #508 [Medium] 2 | 3 | This problem was asked by Dropbox. 4 | 5 | Create an algorithm to efficiently compute the approximate median of a list of numbers. 6 | 7 | More precisely, given an unordered list of N numbers, find an element whose rank is between N / 4 and 3 * N / 4, with a high level of certainty, in less than O(N) time. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00510/README.md: -------------------------------------------------------------------------------- 1 | # Problem #510 [Hard] 2 | 3 | This problem was asked by Airbnb. 4 | 5 | Given a list of words, find all pairs of unique indices such that the concatenation of the two words is a palindrome. 6 | 7 | For example, given the list ["code", "edoc", "da", "d"], return [(0, 1), (1, 0), (2, 3)]. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00513/README.md: -------------------------------------------------------------------------------- 1 | # Problem #513 [Medium] 2 | 3 | This problem was asked by Lyft. 4 | 5 | Given a list of integers and a number K, return which contiguous elements of the list sum to K. 6 | 7 | For example, if the list is [1, 2, 3, 4, 5] and K is 9, then it should return [2, 3, 4], since 2 + 3 + 4 = 9. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00514/README.md: -------------------------------------------------------------------------------- 1 | # Problem #514 [Medium] 2 | 3 | This problem was asked by Microsoft. 4 | 5 | Given an unsorted array of integers, find the length of the longest consecutive elements sequence. 6 | 7 | For example, given [100, 4, 200, 1, 3, 2], the longest consecutive element sequence is [1, 2, 3, 4]. Return its length: 4. 8 | 9 | Your algorithm should run in O(n) complexity. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00515/README.md: -------------------------------------------------------------------------------- 1 | # Problem #515 [Medium] 2 | 3 | This problem was asked by LinkedIn. 4 | 5 | Given a linked list of numbers and a pivot k, partition the linked list so that all nodes less than k come before nodes greater than or equal to k. 6 | 7 | For example, given the linked list 5 -> 1 -> 8 -> 0 -> 3 and k = 3, the solution could be 1 -> 0 -> 5 -> 8 -> 3. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00516/README.md: -------------------------------------------------------------------------------- 1 | # Problem #516 [Easy] 2 | 3 | This problem was asked by Zillow. 4 | 5 | Let's define a "sevenish" number to be one which is either a power of 7, or the sum of unique powers of 7. The first few sevenish numbers are 1, 7, 8, 49, and so on. Create an algorithm to find the nth sevenish number. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00518/README.md: -------------------------------------------------------------------------------- 1 | # Problem #518 [Easy] 2 | 3 | This problem was asked by Microsoft. 4 | 5 | Given an array of numbers and a number k, determine if there are three entries in the array which add up to the specified number k. For example, given [20, 303, 3, 4, 25] and k = 49, return true as 20 + 4 + 25 = 49. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00519/README.md: -------------------------------------------------------------------------------- 1 | # Problem #519 [Medium] 2 | 3 | This problem was asked by Facebook. 4 | 5 | Given three 32-bit integers x, y, and b, return x if b is 1 and y if b is 0, using only mathematical or bit operations. You can assume b can only be 1 or 0. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00522/README.md: -------------------------------------------------------------------------------- 1 | # Problem #522 [Medium] 2 | 3 | This problem was asked by Microsoft. 4 | 5 | Given a string and a pattern, find the starting indices of all occurrences of the pattern in the string. For example, given the string "abracadabra" and the pattern "abr", you should return [0, 7]. -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00523/README.md: -------------------------------------------------------------------------------- 1 | # Problem #523 [Easy] 2 | 3 | This problem was asked by Jane Street. 4 | 5 | Given integers M and N, write a program that counts how many positive integer pairs (a, b) satisfy the following conditions: 6 | 7 | - `a + b = M` 8 | - `a XOR b = N` -------------------------------------------------------------------------------- /Practice/Daily Coding Problem/00524/README.md: -------------------------------------------------------------------------------- 1 | # Problem #524 [Medium] 2 | 3 | This problem was asked by Amazon. 4 | 5 | Given an array of numbers, find the maximum sum of any contiguous subarray of the array. 6 | 7 | For example, given the array [34, -50, 42, 14, -5, 86], the maximum sum would be 137, since we would take elements 42, 14, -5, and 86. 8 | 9 | Given the array [-5, -1, -8, -9], the maximum sum would be 0, since we would not take any elements. 10 | 11 | Do this in O(N) time. -------------------------------------------------------------------------------- /Practice/Google/README.md: -------------------------------------------------------------------------------- 1 | - https://techdevguide.withgoogle.com 2 | -------------------------------------------------------------------------------- /Practice/LeetCode/1 Two Sum.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def twoSum(self, nums, target): 3 | """ 4 | :type nums: List[int] 5 | :type target: int 6 | :rtype: List[int] 7 | """ 8 | for i in xrange(len(nums)): 9 | for j in xrange(i + 1, len(nums)): 10 | if nums[i] + nums[j] == target: 11 | return [i, j] 12 | 13 | -------------------------------------------------------------------------------- /Practice/LeetCode/2020 April LeetCoding Challenge/01 - Single Number.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @param {number[]} nums 3 | * @return {number} 4 | */ 5 | var singleNumber = function(nums) { 6 | result = 0 7 | for (let i = 0; i < nums.length ; i++) { 8 | result ^= nums[i]; 9 | } 10 | return result 11 | }; -------------------------------------------------------------------------------- /Practice/LeetCode/2020 April LeetCoding Challenge/05 - Best Time to Buy and Sell Stock II.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @param {number[]} prices 3 | * @return {number} 4 | */ 5 | var maxProfit = function(prices) { 6 | let result = 0 7 | for (let i = 1; i < prices.length; i++) { 8 | let profit = prices[i] - prices[i - 1] 9 | if (profit > 0) { 10 | result += profit 11 | } 12 | } 13 | return result 14 | }; -------------------------------------------------------------------------------- /Practice/LeetCode/2020 April LeetCoding Challenge/23 - Bitwise AND of Numbers Range.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @param {number} m 3 | * @param {number} n 4 | * @return {number} 5 | */ 6 | var rangeBitwiseAnd = function(m, n) { 7 | while (m < n) { 8 | n -= (n & -n) 9 | } 10 | return n 11 | }; -------------------------------------------------------------------------------- /Practice/LeetCode/2020 May LeetCoding Challenge/04 - Number Complement.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @param {number} num 3 | * @return {number} 4 | */ 5 | var findComplement = function(num) { 6 | let binaryRepresentation = (num >>> 0).toString(2); 7 | let ans = 0; 8 | 9 | [...binaryRepresentation].forEach((value, index) => { 10 | if (value == '0') { 11 | ans += 2 ** (binaryRepresentation.length - index - 1) 12 | } 13 | }); 14 | 15 | return ans 16 | }; -------------------------------------------------------------------------------- /Practice/LeetCode/2020 May LeetCoding Challenge/09 - Valid Perfect Square.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @param {number} num 3 | * @return {boolean} 4 | */ 5 | var isPerfectSquare = function(num) { 6 | let ans = false 7 | for (let i = 1; i <= Math.ceil(num / 2); i++) { 8 | if (i * i == num) { 9 | ans = true; 10 | } 11 | } 12 | return ans 13 | }; -------------------------------------------------------------------------------- /Practice/Spoj/GSS1 - Can you answer these queries.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | long long int n, i, j, a[50005], q, l, r; 4 | int main() 5 | { 6 | cin>>n; 7 | for(i=0;i>a[i]; 9 | } 10 | cin>>q; 11 | for(i=0;i>l>>r; 13 | l--; 14 | r--; 15 | cout<<*max_element(a+l, a+r+1)< 2 | using namespace std; 3 | int c(int n){ 4 | int ans = 1, i; 5 | for(i=2;i<=sqrt(n);i++){ 6 | if(n%i==0){ 7 | ans++; 8 | } 9 | } 10 | return ans; 11 | } 12 | int main() 13 | { 14 | long long int n, i, j, ans; 15 | cin>>n; 16 | ans = 0; 17 | for(j=0;j 2 | using namespace std; 3 | long long int t, n, i, j, ans; 4 | int main() 5 | { 6 | cin>>t; 7 | for(i=0;i>n; 9 | n=n%11; 10 | n=n*8; 11 | n=n%11; 12 | if(n==0){ 13 | cout<<"0"< 2 | using namespace std; 3 | int main() 4 | { 5 | long long int t, n, i, j, ans; 6 | cin>>n; 7 | while(n!=0){ 8 | ans = 0; 9 | for(j=0;j>n; 14 | } 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /Practice/UriOnlineJudge/question1035.py: -------------------------------------------------------------------------------- 1 | #coding: utf-8 2 | 3 | numbers = raw_input().split() 4 | a = int(numbers[0]) 5 | b = int(numbers[1]) 6 | c = int(numbers[2]) 7 | d = int(numbers[3]) 8 | if( (b > c) and (d > a) and ((c + d) > (a + b)) and (c > 0) and (d > 0) and (a % 2 == 0)): 9 | print("Valores aceitos") 10 | else: 11 | print("Valores nao aceitos") 12 | -------------------------------------------------------------------------------- /Practice/UriOnlineJudge/question1036.py: -------------------------------------------------------------------------------- 1 | #coding: utf-8 2 | import math 3 | 4 | num = raw_input().split() 5 | a = float(num[0]) 6 | b = float(num[1]) 7 | c = float(num[2]) 8 | 9 | delta = (b**2) - (4 * a) * c 10 | 11 | if ((delta <= 0) or (a == 0)): 12 | print("Impossivel calcular") 13 | else: 14 | r1 = ((-b) + math.sqrt(delta)) / (2 * a ) 15 | r2 = ((-b) - math.sqrt(delta)) / (2 * a ) 16 | print ("R1 = %.5f" % r1) 17 | print ("R2 = %.5f" % r2) 18 | -------------------------------------------------------------------------------- /Practice/UriOnlineJudge/question1037.py: -------------------------------------------------------------------------------- 1 | #coding: utf-8 2 | 3 | num = float(raw_input()) 4 | 5 | if ( num >= 0 and num <= 25): 6 | print("Intervalo [0,25]") 7 | elif (num > 25 and num <= 50): 8 | print("Intervalo (25,50]") 9 | elif (num > 50 and num <= 75): 10 | print("Intervalo (50,75]") 11 | elif (num > 75 and num <= 100): 12 | print("Intervalo (75,100]") 13 | else: 14 | print("Fora de intervalo") 15 | -------------------------------------------------------------------------------- /Practice/UriOnlineJudge/question1038.py: -------------------------------------------------------------------------------- 1 | #coding: utf-8 2 | 3 | 4 | num = raw_input().split() 5 | opc = int(num[0]) 6 | qtd = int(num[1]) 7 | 8 | 9 | if (opc == 1): 10 | print("Total: R$ %.2f" % (4.0 * qtd)) 11 | elif (opc == 2): 12 | print("Total: R$ %.2f" % (4.5* qtd)) 13 | elif (opc == 3): 14 | print("Total: R$ %.2f" % (5.0 * qtd)) 15 | elif (opc == 4): 16 | print("Total: R$ %.2f" % (2.0 * qtd)) 17 | else: 18 | print("Total: R$ %.2f" % (1.5 * qtd)) 19 | 20 | -------------------------------------------------------------------------------- /Practice/UriOnlineJudge/question1041.py: -------------------------------------------------------------------------------- 1 | #coding: utf-8 2 | 3 | coord = raw_input().split() 4 | x = float(coord[0]) 5 | y = float(coord[1]) 6 | 7 | if (x==y==0): 8 | print("Origem\n") 9 | elif(x==0): 10 | print("Eixo X\n") 11 | elif(y==0): 12 | print("Eixo Y\n") 13 | elif(x>0)and(y>0): 14 | print("Q1\n") 15 | elif(x<0)and(y>0): 16 | print("Q2\n") 17 | elif(x<0) and (y<0): 18 | print("Q3\n") 19 | elif(x>0)and(y<0): 20 | print("Q4\n") 21 | -------------------------------------------------------------------------------- /Practice/UriOnlineJudge/question1042.py: -------------------------------------------------------------------------------- 1 | #coding: utf-8; 2 | 3 | 4 | num = raw_input().split() 5 | 6 | a = int(num[0]) 7 | b = int(num[1]) 8 | c = int(num[2]) 9 | 10 | if (a >= b): 11 | a,b = b,a 12 | if(a >= c): 13 | a,c = c,a 14 | if( b >= c): 15 | b,c = c,b 16 | 17 | print ("%d\n%d\n%d\n" %(a,b,c)) 18 | for x in range(len(num)): 19 | print num[x] 20 | -------------------------------------------------------------------------------- /Practice/UriOnlineJudge/question1043.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | num = raw_input().split() 4 | a = float(num[0]) 5 | b = float(num[1]) 6 | c = float(num[2]) 7 | 8 | if( abs(a - b) < c < a + b): 9 | if (abs(c - a) < b < a + c): 10 | if (abs(b - c) < a < b + c): 11 | print ("Perimetro = %.1f" % (a + b + c)) 12 | else: 13 | print("Area = %.1f" % ( (( a + b ) * c )/2)) 14 | -------------------------------------------------------------------------------- /Practice/UriOnlineJudge/question1044.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | num = raw_input().split() 4 | a = int(num[0]) 5 | b = int(num[1]) 6 | 7 | if ((a % b == 0 )or (b % a == 0)): 8 | print ("Sao Multiplos") 9 | else: 10 | print ("Nao sao Multiplos") 11 | -------------------------------------------------------------------------------- /Practice/UriOnlineJudge/question1050.py: -------------------------------------------------------------------------------- 1 | #coding: utf-8 2 | 3 | 4 | ddd = int(raw_input()) 5 | 6 | 7 | if (ddd == 61): print("Brasilia") 8 | elif(ddd == 71): print("Salvador") 9 | elif(ddd == 11): print("Sao Paulo") 10 | elif(ddd == 21): print("Rio de Janeiro") 11 | elif(ddd == 32): print("Juiz de Fora") 12 | elif(ddd == 19): print("Campinas") 13 | elif(ddd == 27): print("Vitoria") 14 | elif(ddd == 31): print("Belo Horizonte") 15 | else: print("DDD nao cadastrado") 16 | -------------------------------------------------------------------------------- /Practice/UriOnlineJudge/question1051.py: -------------------------------------------------------------------------------- 1 | #coding: utf-8 2 | 3 | sal = float(raw_input()) 4 | 5 | if (sal <= 2000): print("Isento") 6 | elif(2000 < sal <= 3000): print("R$ %.2f" % ((sal- 2000) * 0.08)) 7 | elif(3000 < sal <= 4500): print("R$ %.2f" % ((sal - 3000) * 0.18 + (1000 * 0.08))) 8 | elif(4500< sal): print("R$ %.2f" %((sal - 4500) *0.28 + (1500 *0.18) + (1000 * 0.08))) 9 | -------------------------------------------------------------------------------- /Resources/Antti Laaksonen - Guide to Competitive Programming.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Resources/Antti Laaksonen - Guide to Competitive Programming.pdf -------------------------------------------------------------------------------- /Resources/Bjarne Stroustrup - A Tour of C++.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Resources/Bjarne Stroustrup - A Tour of C++.pdf -------------------------------------------------------------------------------- /Resources/Brian W. Kernighan, Dennis M. Ritchie - The C Programming Language.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Resources/Brian W. Kernighan, Dennis M. Ritchie - The C Programming Language.pdf -------------------------------------------------------------------------------- /Resources/Cpp_reference.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Resources/Cpp_reference.pdf -------------------------------------------------------------------------------- /Resources/Cracking-the-Coding-Interview-4ed.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Resources/Cracking-the-Coding-Interview-4ed.pdf -------------------------------------------------------------------------------- /Resources/Document from Od: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Resources/Document from Od -------------------------------------------------------------------------------- /Resources/Game Theory - Thomas S. Ferguson.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Resources/Game Theory - Thomas S. Ferguson.pdf -------------------------------------------------------------------------------- /Resources/How to Prepare Yourself for an Interview with Google.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Resources/How to Prepare Yourself for an Interview with Google.pdf -------------------------------------------------------------------------------- /Resources/Joseph H. Silverman - A Friendly Introduction to Number Theory.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Resources/Joseph H. Silverman - A Friendly Introduction to Number Theory.pdf -------------------------------------------------------------------------------- /Resources/Ronald L. Graham, Donald E. Knuth, Oren Patashnik - Concrete Mathematics.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Resources/Ronald L. Graham, Donald E. Knuth, Oren Patashnik - Concrete Mathematics.pdf -------------------------------------------------------------------------------- /Resources/STL Quick Reference 1.29.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Resources/STL Quick Reference 1.29.pdf -------------------------------------------------------------------------------- /Resources/Steven Halim, Felix Halim - Competitive Programming 3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Resources/Steven Halim, Felix Halim - Competitive Programming 3.pdf -------------------------------------------------------------------------------- /Resources/Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, Clifford Stein - Introduction to Algorithms.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Resources/Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, Clifford Stein - Introduction to Algorithms.pdf -------------------------------------------------------------------------------- /Resources/atlassian_git_cheatsheet.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Resources/atlassian_git_cheatsheet.pdf -------------------------------------------------------------------------------- /Resources/books/Competitive Programmer’s Handbook.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Resources/books/Competitive Programmer’s Handbook.pdf -------------------------------------------------------------------------------- /Resources/books/Competitive Programming 1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Resources/books/Competitive Programming 1.pdf -------------------------------------------------------------------------------- /Resources/books/Competitive Programming 3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Resources/books/Competitive Programming 3.pdf -------------------------------------------------------------------------------- /Resources/books/Michael T. Goodrich, Roberto Tamassia, Michael H. Goldwasser-Data Structures and Algorithms in Python-Wiley (2013).pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Resources/books/Michael T. Goodrich, Roberto Tamassia, Michael H. Goldwasser-Data Structures and Algorithms in Python-Wiley (2013).pdf -------------------------------------------------------------------------------- /Resources/books/The Four Pillars of Geometry.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Resources/books/The Four Pillars of Geometry.pdf -------------------------------------------------------------------------------- /Resources/books/The Hitchhiker’s Guide to_the Programming Contests.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Resources/books/The Hitchhiker’s Guide to_the Programming Contests.pdf -------------------------------------------------------------------------------- /Resources/crackingthefacebookcodinginterview-oct2014-141028192813-conversion-gate02.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Resources/crackingthefacebookcodinginterview-oct2014-141028192813-conversion-gate02.pptx -------------------------------------------------------------------------------- /Resources/google.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kushal997-das/Competitive-Programming/c0a2dee3af2a578e9d28327a79a8915fddfd62b7/Resources/google.pdf --------------------------------------------------------------------------------