Sunday, May 23, 2021

HACKERRANK - INTERVIEW PREP KIT- SOLUTIONS IN CPP

HACKERRANK INTERVIEW PREP KIT SOLUTIONS-

* WARM-UP CHALLEGES-


COUNTING VALLEYS

PROBLEM



* DATA STRUCTURES


ARRAY


LINKED LIST


STACK


QUEUE



 HACKERRANK - CRACKING THE CODING INTERVIEW TUTORIALS SOLUTIONS IN CPP


HASH TABLES - RANSOM NOTE

PROBLEM

Complete the checkMagazine function in the editor below. It must print  if the note can be formed using the magazine, or .

checkMagazine has the following parameters:

  • string magazine[m]: the words in the magazine
  • string note[n]: the words in the ransom note

Prints

  • string: either  or , no return value is expected

Input Format

The first line contains two space-separated integers,  and , the numbers of words in the  and the , respectively.
The second line contains  space-separated strings, each .
The third line contains  space-separated strings, each .

Constraints

  • .
  • Each word consists of English alphabetic letters (i.e.,  to  and  to ).

Sample Input 0

6 4
give me one grand today night
give one grand today

Sample Output 0

Yes
MY SOLUTION-
void checkMagazine(vector<string> magazine, vector<string> note) {
    //Simple finding in the string magazine - passes some test cases
    // for(int i = 0; i < note.size();){
    //     if(find(magazine.begin()+i, magazine.end(), note[i]) != magazine.end())
    //         i++;
    //     else{
    //         cout << "No" <<"\n";
    //         return;
    //     }    
    // }
    // cout << "Yes" <<"\n";
//Hashing in Strings
    unordered_map<string, int>words;
    
    for(auto &it: magazine){ //N words
        words[it]++;
    }
    
    for(auto &it : note){// M words
        if(words[it]> 0){
            words[it]--;
        }
        else{
            cout << "No" <<"\n";
            return;
        }
    }
    cout << "Yes" <<"\n";
    return;
}
TC = O(N+M)

Thursday, May 20, 2021

GENERAL CODING TIPS

 BEGINNER PROGRAMMING TIPS - ANUJ BHAIYA

* START WITH A GOAL-

WORK BACKWARDS FROM A BIG GOAL

* FIRST PROGRAMMING LANGUAGE-

PYTHON

LEARNPYTHON.ORG, FREECODECAMP

YOUTUBE

UDEMY COURSES

1 TUTORIAL - BEST ONE - TAKE AND START AND COMPLETE IT

* BEGINNER - DON'T FOCUS MUCH ON DETAILS

* MAKE A ROUTINE FOR CODING - 

DAILY 2 HR - DSA

DAILY 2 HR- DEV

CONSISTENCY

DON'T GIVE UP

* MAKE PROJECTS WHILE LEARNING

UNDERSTAND MEANING OF ALL THINGS 

IMPLEMENT 1ST

THEN MAKE SOME IMPROVEMENTS

* AFTER PROGRAMMING LANGUAGE - MOVE TO DSA

FOR DSA -  USE CPP OR JAVA

LEARN IMP DS AND ALGORITHMS

LEARN CONCEPT - AT LEAST PRACTICE 10 Q

LEETCODE / HACKERRANK - PRACTICE DSA

* DEVELOPMENT - PROJECTS

* ITS OKAY TO TAKE TIME TO LEARN A NEW LANGUAGE AND TECHNOLOGY

* ITS OKAY TO SEE EDITORIAL

* ITS OKAY TO REACH OUT FOR HELP

HELP OTHERS ALSO IF U KNOW

* DON'T GIVE UP

* 1 THING AT A TIME

* PROGRAMMING LANGUAGE + DSA - DAILY IMP 

THEN DEV + PROJECTS


HOW ANUJ BHAIYA BECAME SELF TAUGHT PROGRAMMER? - ANUJ BHAIYA

*HAVE A BIG GOAL - FOR MOTIVATION -

*DON'T GIVE UP

*ANY LANGUAGE - 

THEORY =  5%

PRACTICAL = PROJECTS = 95%

*OBJECT ORIENTED PROGRAMMING LANGUAGE- CPP/ JAVA

HE LEARNT JAVA - BOOK + HAY OF PROGRAMMING BOOK

DSA STUDY STARTED

CODECHEF - LESS BEGINNER-FRIENDLY

HACKERRANK, HACKEREARTH - PRACTICE + CONTESTS

ANDROID DEVELOPMENT-

UDEMY - FREE COURSE

YOUTUBE PLAYLIST 

HIS ANDROID DEV PLAYLIST

TO LEARN NEW THING -

MAKE A GOAL TO MAKE PROJECT AND THEN LEARN THINGS TO MAKE THAT PROJECT

* DSA - FOLLOW A STRUCTURE

INTERVIEW BIT

BREADTH FIRST APPROACH RATHER THAN DEPTH FIRST

* LEARN A FRAMEWORK/ TECH

LEARN JUST ENOUGH

MAKE PROJECTS

IMPLEMENT THINGS

IMPLEMENTATION IS THE KEY

MAKE UR TODAY BETTER THAN YESTERDAY










Wednesday, May 19, 2021

DSA TIPS - CODING NINJAS

 DSA ROADMAP - CODING NINJAS


DSA TOPICS-

Roadmap For Practicing Data Structures And Algorithms

Practice Link

https://www.codingninjas.com/codestudio/guided-paths/data-structures-algorithms

Arrays & Strings

Basic Array And Strings Questions

Kadane's Algorithm

Dutch National Flag Algorithm

Sliding Window

Two pointers

Multidimensional arrays

Traversal Based Problems

Rotation Based Problems

Recursion And Backtracking

Basic Recursion Questions

Divide And Conquer

Sorting Algoritms

Insertion Sort

Selection Sort

Binary Search Applications

Binary Search On Arrays

Binary Search On Matrix

Linked Lists

Reversal Problems

Sorting Problems

Slow And Fast Pointers

Modify In Linked list

Stacks & Queues

Implementation Based Problems

Application Based Problems

Binary Trees

Tree Traversals

Construction Of Trees

Tree Views

Standard Problems

BST

Construction Of BST

Conversion Based Problems

Modification in BST

Standard Problems 

Priority Queues And Heaps

Implementation Based problems

Conversion based problems

K Based Problems

Graphs

Graph Traversals - BFS And DFS

MST

Shortest Path Algorithms

Topological Sort

Graphs in Matrix

Dynamic Programming

DP with Arrays

DP With Strings

DP With Maths

DP With Trees

Breaking And Partition Based Problems

Counting Based Problems

Hard Recursion And Backtracking Questions

Other Topics

Hashmaps

Tries

Bit Manipulation

Greedy

Circular Queues

Deques - Hot Topic

Doubly And Circular LL

String Algorithms like KMP and Z Algorithm


TIME REQD FOR ALL TOPICS-

LINK

CP TIPS - CODING NINJAS - COMPETITIVE PROGRAMMING ROADMAP

TIPS/ ROADMAP OF CP - CODING NINJAS

-BENEFITS
HELP IN PLACEMENT
STAND OUT
ROUND 1 OF DSA INTERVIEWS

-LANGUAGE
C++/JAVA 
C++ PREFERED

-PREREQUISITES
DS ALGO-
EASY, MEDIUM Q
 
  1. ARRAY
  2. STRINGS
  3. LINKE LIST
  4. STACKS
  5. QUEUES
  6. RECURSION
  7. TREES
  8. PRIORITY QUEUES
  9. GRAPHS
  10. HASH MAPS
  11. DYNAMIC PROGRAMMING

-RESOURCES
  1. GUIDE TO CP BOOK
  2. CP ALGORITHMS
  3. CSES PROBLEM SET
  4. GUIDED PATH - CODING NINJAS

PATH OF CP-
  1. STL CPP/ COLLECTIONS JAVA
  2. BINARY SEARCH & ITS APPLICATIONS
  3. BIT MANIPULATION
  4. GREEDY ALGORITHMS
  5. MODULAR ARITHMETIC
  6. DYNAMIC PROGRAMMING HARD Q
  7. SEGMENT TREE - RANGE QUERIES
  8. GRAPH
  9. NUMBER THEORY
  10. MATHS OTHER TOPICS

EVERY TOPIC STUDY/ LEARN TOPIC + 10Q EACH TOPIC PRACTICE

PLATFORM PRACTICE-
CODEFORCES - DSA + MATH Q
CODECHEF - MATHS MORE Q

CONTESTS PARTICIPATE  + STUDY EXTRA TOPICS
  1. STRING ALGO
  2. BIT MASKING IN DP
  3. FENWICK TREE
  4. GAME THEORY
  5. COMPUTATIONAL GEOMETRY
  6. MIXED PROBLEMS
  7. HLD, FFT

PARTICIPATE IN CONTESTS -
PARTICIPATE IN FULL TIME
LEARN TOPIC IF NOT, ELSE REVISE TOPIC - THEN AGAIN TRY TO SOLVE QUESTION
READ EDITORIAL, CODE URSELF
IF CANT - READ SOLUTION ALSO, AND CODE WITHOUT SEEING AND MARK QUESTION TO REVISE AFTER 15 DAYS

 LINK-
Roadmap For Competitive Programming
-Motive Behind Competitive Programming
Excellent Problem Solving Skills
Standout Amongst Others If You Have Done Well
Helps In Company's Online Round
-Language?
C++ 
Java 
Python
-Pre Requisites
Basics Of Data Structures and Algorithms
Arrays
Strings
Recursion
Linked List
Stacks
Queues
Trees
Hashmap
Graphs
Priority Queue
Basic Dynamic Programming
-Resources
Guide to cp Book 
CSES problem set
Cp Algorithms
Codestudio (Coming soon)
-Path
STL/Collections
Binary Search Applications
Bit Manipulation
Greedy Algorithms
Modulo Arithmetic
Dynamic Programming
Segment Tree
Graphs
BFS DFS
Graph Algorithms
Number Theory
-Start Giving Contests FROM here
Codeforces Div 3 Contests
Codeforces Virutal Contests
String Processing
KMP
Z Algo
Manacher's Algorithm
DP With Bitmasking
Game Theory
Computational Geometry
Fenwick Tree
Mixed Problems Of DP and Graphs
HLD, FFT (Optional)
-How To Practice In Contests?
Give Full Time On Contest
Do not go here and there.


LEETCODE JUNE 2021 DAILY CODING CHALLENGE

 LEETCODE JUNE 2021 DAILY CODING CHALLENGE JUNE 1 JUNE 2 JUNE 3 JUNE 4 JUNE 5 Maximum Performance of a Team LINK You are given two integers ...