shashCode
shashCode
  • 562
  • 1 366 646
1497. Check If Array Pairs Are Divisible by k | maths | hash | Leetcode Daily Challenge | DSA | Java
Problem Name:
1497. Check If Array Pairs Are Divisible by k
Problem Statement:
Given an array of integers arr of even length n and an integer k.
We want to divide the array into exactly n / 2 pairs such that the sum of each pair is divisible by k.
Return true If you can find a way to do that or false otherwise.
Problem Link:
leetcode.com/problems/check-if-array-pairs-are-divisible-by-k/description/?envType=daily-question&envId=2024-10-01
Solution Link:
github.com/Tiwarishashwat/InterviewCodes/blob/main/checkIFArrayPairsAreDivisiblebyK.java
Graph Playlist:
th-cam.com/play/PLQ7ZAf76c0ZOGuMjg3qwNgILb_dKWTxyQ.html
Java Plus DSA Placement Course Playlist:
th-cam.com/play/PLQ7ZAf76c0ZPVdhV1bAjFv0bQc1xHURzE.html
Java Plus DSA Sheet:
docs.google.com/spreadsheets/d/119u25NO-4ZJ9zwfUKs5eGNo0exCVq3gZEFWvkCDiMqI/edit?usp=sharing
Notes:
github.com/Tiwarishashwat/Java-Plus-DSA-Placement-Course
Telegram Link:
shashwattiwari.page.link/telegramShashwat
Ultimate Recursion Series Playlist:
th-cam.com/play/PLQ7ZAf76c0ZMzC9OHPbo-dUgx6oU3T0jK.html
Instagram Handle: (@shashwat_tiwari_st)
shashwattiwari.page.link/shashwatInsta
Samsung Interview Experience:
th-cam.com/video/GrvlpBzphSU/w-d-xo.html
Company Tags:
Facebook | Amazon | Microsoft | Netflix | Google | LinkedIn | Pega Systems | VMware | Adobe | Samsung
Timestamp:
0:00 - Introduction
#ShashwatTiwari #coding​​ #problemsolving​
มุมมอง: 223

วีดีโอ

1381. Design a Stack With Increment Operation | stack | Leetcode Daily Challenge | DSA | Java
มุมมอง 1.1K2 ชั่วโมงที่ผ่านมา
Problem Name: 1381. Design a Stack With Increment Operation Problem Statement: Design a stack that supports increment operations on its elements. Implement the CustomStack class: CustomStack(int maxSize) Initializes the object with maxSize which is the maximum number of elements in the stack. void push(int x) Adds x to the top of the stack if the stack has not reached the maxSize. int pop() Pop...
432. All O`one Data Structure | doubly linked list | hashing | Leetcode Daily Challenge | DSA | Java
มุมมอง 1.8K4 ชั่วโมงที่ผ่านมา
Problem Name: 432. All O`one Data Structure Problem Statement: Design a data structure to store the strings' count with the ability to return the strings with minimum and maximum counts. Implement the AllOne class: AllOne() Initializes the object of the data structure. inc(String key) Increments the count of the string key by 1. If key does not exist in the data structure, insert it with count ...
641. Design Circular Deque | deque | queue | Leetcode Daily Challenge | DSA | Java
มุมมอง 1.1K4 ชั่วโมงที่ผ่านมา
Problem Name: 641. Design Circular Deque Problem Statement: Design your implementation of the circular double-ended queue (deque). Implement the MyCircularDeque class: MyCircularDeque(int k) Initializes the deque with a maximum size of k. boolean insertFront() Adds an item at the front of Deque. Returns true if the operation is successful, or false otherwise. boolean insertLast() Adds an item a...
731. My Calendar II | intervals | Line Sweep algo | Leetcode Daily Challenge | DSA | Java
มุมมอง 1.4K9 ชั่วโมงที่ผ่านมา
Problem Name: 731. My Calendar II Problem Statement: You are implementing a program to use as your calendar. We can add a new event if adding the event will not cause a triple booking. A triple booking happens when three events have some non-empty intersection (i.e., some moment is common to all the three events.). The event can be represented as a pair of integers start and end that represents...
729. My Calendar I | balanced trees | Leetcode Daily Challenge | DSA | Java
มุมมอง 2.1K12 ชั่วโมงที่ผ่านมา
Problem Name: 729. My Calendar I Problem Statement: You are implementing a program to use as your calendar. We can add a new event if adding the event will not cause a double booking. A double booking happens when two events have some non-empty intersection (i.e., some moment is common to both events.). The event can be represented as a pair of integers start and end that represents a booking o...
2416. Sum of Prefix Scores of Strings | tries | Leetcode Daily Challenge | DSA | Java
มุมมอง 1.4K14 ชั่วโมงที่ผ่านมา
Problem Name: 2416. Sum of Prefix Scores of Strings Problem Statement: You are given an array words of size n consisting of non-empty strings. We define the score of a string word as the number of strings words[i] such that word is a prefix of words[i]. For example, if words = ["a", "ab", "abc", "cab"], then the score of "ab" is 2, since "ab" is a prefix of both "ab" and "abc". Return an array ...
3043. Find the Length of the Longest Common Prefix | Tries | Leetcode Daily Challenge | DSA | Java
มุมมอง 1.8K16 ชั่วโมงที่ผ่านมา
Replace Words (tries explanation & prefix problem) th-cam.com/video/9ryPEEudxbo/w-d-xo.html Problem Name: 3043. Find the Length of the Longest Common Prefix Problem Statement: You are given two arrays with positive integers arr1 and arr2. A prefix of a positive integer is an integer formed by one or more of its digits, starting from its leftmost digit. For example, 123 is a prefix of the intege...
2707. Extra Characters in a String | DP | recusion | Leetcode Daily Challenge | DSA | Java
มุมมอง 3K19 ชั่วโมงที่ผ่านมา
Problem Name: 2707. Extra Characters in a String Problem Statement: You are given a 0-indexed string s and a dictionary of words dictionary. You have to break s into one or more non-overlapping substrings such that each substring is present in dictionary. There may be some extra characters in s which are not present in any of the substrings. Return the minimum number of extra characters left ov...
386. Lexicographical Numbers | DFS | recusion | Leetcode Daily Challenge | DSA | Java
มุมมอง 1.9Kวันที่ผ่านมา
Problem Name: 386. Lexicographical Numbers Problem Statement: Given an integer n, return all the numbers in the range [1, n] sorted in lexicographical order. You must write an algorithm that runs in O(n) time and uses O(1) extra space. Problem Link: leetcode.com/problems/lexicographical-numbers/description/?envType=daily-question&envId=2024-09-21 Solution Link: github.com/Tiwarishashwat/Intervi...
241. Different Ways to Add Parentheses | DP | recursion | Leetcode Daily Challenge | DSA | Java
มุมมอง 2.5Kวันที่ผ่านมา
Problem Name: 241. Different Ways to Add Parentheses Problem Statement: Given a string expression of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. You may return the answer in any order. The test cases are generated such that the output values fit in a 32-bit integer and the number of different results does not ...
179. Largest Number | sorting | string | Leetcode Daily Challenge | DSA | Java | hindi
มุมมอง 3.6Kวันที่ผ่านมา
Problem Name: 179. Largest Number Problem Statement: Given a list of non-negative integers nums, arrange them such that they form the largest number and return it. Since the result may be very large, so you need to return a string instead of an integer. Problem Link: leetcode.com/problems/largest-number/description/?envType=daily-question&envId=2024-09-18 Solution Link: github.com/Tiwarishashwa...
L-34 | Strongly Connected Components | Kosaraju algorithm | Graphs | GFG | DSA | Java | hindi
มุมมอง 122วันที่ผ่านมา
Problem Name: Strongly Connected Components (Kosaraju's Algo) Problem Statement: Given a Directed Graph with V vertices (Numbered from 0 to V-1) and E edges, Find the number of strongly connected components in the graph. Problem Link: www.geeksforgeeks.org/problems/strongly-connected-components-kosarajus-algo/1 Solution Link: github.com/Tiwarishashwat/InterviewCodes/blob/main/KosarajuAlgo.java ...
884. Uncommon Words from Two Sentences | string | Leetcode Daily Challenge | DSA | Java | hindi
มุมมอง 2.1K14 วันที่ผ่านมา
Problem Name: 884. Uncommon Words from Two Sentences Problem Statement: A sentence is a string of single-space separated words where each word consists only of lowercase letters. A word is uncommon if it appears exactly once in one of the sentences, and does not appear in the other sentence. Given two sentences s1 and s2, return a list of all the uncommon words. You may return the answer in any...
539. Minimum Time Difference | sorting | string | Leetcode Daily Challenge | DSA | Java | hindi
มุมมอง 2K14 วันที่ผ่านมา
Problem Name: 539. Minimum Time Difference Problem Statement: Given a list of 24-hour clock time points in "HH:MM" format, return the minimum minutes difference between any two time-points in the list. Problem Link: leetcode.com/problems/minimum-time-difference/description/?envType=daily-question&envId=2024-09-16 Solution Link: github.com/Tiwarishashwat/InterviewCodes/blob/main/minimumTimeDiffe...
L-37 | Kruskal's Algorithm | Minimum Spanning Tree | MST | Graphs | DSA | Java | hindi
มุมมอง 20314 วันที่ผ่านมา
L-37 | Kruskal's Algorithm | Minimum Spanning Tree | MST | Graphs | DSA | Java | hindi
L-36 | Prim's Algorithm | Minimum Spanning Tree | MST | Graphs | DSA | Java | hindi
มุมมอง 13414 วันที่ผ่านมา
L-36 | Prim's Algorithm | Minimum Spanning Tree | MST | Graphs | DSA | Java | hindi
L-35 | Intro to Spanning Tree | Minimum Spanning Tree | MST | Graphs | DSA | Java | hindi
มุมมอง 9414 วันที่ผ่านมา
L-35 | Intro to Spanning Tree | Minimum Spanning Tree | MST | Graphs | DSA | Java | hindi
2220. Minimum Bit Flips to Convert Number | Bits | Leetcode Daily Challenge | DSA | Java | hindi
มุมมอง 2.2K14 วันที่ผ่านมา
2220. Minimum Bit Flips to Convert Number | Bits | Leetcode Daily Challenge | DSA | Java | hindi
2807. Insert Greatest Common Divisors in Linked List | linked list | Leetcode Daily Challenge DSA
มุมมอง 1.4K21 วันที่ผ่านมา
2807. Insert Greatest Common Divisors in Linked List | linked list | Leetcode Daily Challenge DSA
2326. Spiral Matrix IV | matrix | Leetcode Daily Challenge | DSA | Java | hindi
มุมมอง 2.1K21 วันที่ผ่านมา
2326. Spiral Matrix IV | matrix | Leetcode Daily Challenge | DSA | Java | hindi
L-30 | 684. Redundant Connection | graphs | dsu | list | Leetcode | DSA | Java | hindi
มุมมอง 18521 วันที่ผ่านมา
L-30 | 684. Redundant Connection | graphs | dsu | list | Leetcode | DSA | Java | hindi
L-28 | 2976. Minimum Cost to Convert String I | graphs | shortest path | Leetcode | DSA | Java
มุมมอง 10421 วันที่ผ่านมา
L-28 | 2976. Minimum Cost to Convert String I | graphs | shortest path | Leetcode | DSA | Java
L-26 | 743. Network Delay Time | graphs | shortest path problem | Leetcode | DSA | Java | hindi
มุมมอง 8921 วันที่ผ่านมา
L-26 | 743. Network Delay Time | graphs | shortest path problem | Leetcode | DSA | Java | hindi
L-27 | 787. Cheapest Flights Within K Stops | graphs | shortest path | Leetcode | DSA | Java | hindi
มุมมอง 9821 วันที่ผ่านมา
L-27 | 787. Cheapest Flights Within K Stops | graphs | shortest path | Leetcode | DSA | Java | hindi
L-32 | 1319. Number of Operations to Make Network Connected | graphs | dsu | Leetcode | DSA | Java
มุมมอง 6221 วันที่ผ่านมา
L-32 | 1319. Number of Operations to Make Network Connected | graphs | dsu | Leetcode | DSA | Java
L-33 | 785. Is Graph Bipartite? | linked list | Leetcode Daily Challenge | DSA | Java | hindi
มุมมอง 8121 วันที่ผ่านมา
L-33 | 785. Is Graph Bipartite? | linked list | Leetcode Daily Challenge | DSA | Java | hindi
L-31 | 990. Satisfiability of Equality Equations | graphs | dsu | Leetcode | DSA | Java | hindi
มุมมอง 6721 วันที่ผ่านมา
L-31 | 990. Satisfiability of Equality Equations | graphs | dsu | Leetcode | DSA | Java | hindi
725. Split Linked List in Parts | linked list | Leetcode Daily Challenge | DSA | Java | hindi
มุมมอง 1.8K21 วันที่ผ่านมา
725. Split Linked List in Parts | linked list | Leetcode Daily Challenge | DSA | Java | hindi
1367. Linked List in Binary Tree | linked list | Leetcode Daily Challenge | DSA | Java | hindi
มุมมอง 2.7K21 วันที่ผ่านมา
1367. Linked List in Binary Tree | linked list | Leetcode Daily Challenge | DSA | Java | hindi

ความคิดเห็น

  • @dhananjaybamhande1604
    @dhananjaybamhande1604 ชั่วโมงที่ผ่านมา

    Shashwat sir you are my god and you look like my Big brother so i am understand easily.

  • @PiyushSharma-we8yd
    @PiyushSharma-we8yd 2 ชั่วโมงที่ผ่านมา

    ❤❤❤

  • @Nitinkumarsharma-q2x
    @Nitinkumarsharma-q2x 2 ชั่วโมงที่ผ่านมา

    first person to watch 100%

  • @shashwat_tiwari_st
    @shashwat_tiwari_st 2 ชั่วโมงที่ผ่านมา

    Like target for this video 130. Please do like if you were able to understand this question!😄😄

  • @DarkDragon-bz6qp
    @DarkDragon-bz6qp 13 ชั่วโมงที่ผ่านมา

    pls make a video on soft delete?

  • @akshaykhandelwal588
    @akshaykhandelwal588 16 ชั่วโมงที่ผ่านมา

    Inorder Traversal - 4, 2, 5, 1, 3, 6 Preorder Traversal - 1, 2, 4, 5, 3, 6 Postorder Traversal - 4, 5, 2, 6, 3, 1

  • @GhanshyamDobariya90
    @GhanshyamDobariya90 17 ชั่วโมงที่ผ่านมา

    Sir ji.. dher sara dhanyawaad or pyaar from surat, gujarat... i m mentoring one person who want to become python engineer, but i am in to frontend engineering.. i have referred your channel to him.

  • @sourabhgarg2890
    @sourabhgarg2890 18 ชั่วโมงที่ผ่านมา

    sir please check my comment on yesterday vedio, i used PQ and used lazy technique

  • @ParikshitShrestha-o1z
    @ParikshitShrestha-o1z 19 ชั่วโมงที่ผ่านมา

    static void OddEven(int num) { if((num&1)!=0) { System.out.println("Odd"); }else { System.out.println("Even"); } }

  • @AkashSingh-iq4kw
    @AkashSingh-iq4kw วันที่ผ่านมา

    deserved a sub!

  • @codencode5546
    @codencode5546 วันที่ผ่านมา

    Learn new Concept++

  • @crystalclear3717
    @crystalclear3717 วันที่ผ่านมา

    sir dp series kb ayega

  • @VaibhavNathe-k1w
    @VaibhavNathe-k1w วันที่ผ่านมา

    Just completed this question with the knowledge you provided. Thanks a lot. Very helpful videos you have uploaded

  • @PiyushSharma-we8yd
    @PiyushSharma-we8yd วันที่ผ่านมา

    first😁

  • @shashwat_tiwari_st
    @shashwat_tiwari_st วันที่ผ่านมา

    like target for this video is 130. Please do like if you have understood the explanation as well as the code😃😃

  • @physicswalllashortvideo4125
    @physicswalllashortvideo4125 วันที่ผ่านมา

    sir jo rough work kerta ha uska pdf provid kr dejiya please sir please🙏🙏🙏🙏🙏🙏🙏🙏☝

  • @lakithakare7387
    @lakithakare7387 วันที่ผ่านมา

    Thanks bhaiya...!!!

  • @kunwaryadav9586
    @kunwaryadav9586 วันที่ผ่านมา

    Please reply sir, kitne lectures aur remaining hain ?? Aur kitne time me finish ho jaayega pura course ? Please reply

  • @sainakhatun1619
    @sainakhatun1619 วันที่ผ่านมา

    ky lecture khtm ho gya ab ,,,,

  • @sourabhgarg2890
    @sourabhgarg2890 วันที่ผ่านมา

    why cant use PQ sir

    • @shashwat_tiwari_st
      @shashwat_tiwari_st วันที่ผ่านมา

      @@sourabhgarg2890 pq se constant time me kaise krenge.. logN time hota hai na insert/delete/get etc..

    • @sourabhgarg2890
      @sourabhgarg2890 วันที่ผ่านมา

      @@shashwat_tiwari_st import java.util.*; class AllOne { private HashMap<String, Integer> keyCount; private PriorityQueue<Pair> minPQ; private PriorityQueue<Pair> maxPQ; private class Pair { int count; String key; Pair(String key, int count) { this.key = key; this.count = count; } } public AllOne() { keyCount = new HashMap<>(); minPQ = new PriorityQueue<>((a, b) -> Integer.compare(a.count, b.count)); maxPQ = new PriorityQueue<>((a, b) -> Integer.compare(b.count, a.count)); } public void inc(String key) { keyCount.put(key, keyCount.getOrDefault(key, 0) + 1); int newCount = keyCount.get(key); minPQ.offer(new Pair(key, newCount)); maxPQ.offer(new Pair(key, newCount)); } public void dec(String key) { if (!keyCount.containsKey(key)) return; int newCount = keyCount.get(key) - 1; if (newCount == 0) { keyCount.remove(key); } else { keyCount.put(key, newCount); minPQ.offer(new Pair(key, newCount)); maxPQ.offer(new Pair(key, newCount)); } } public String getMaxKey() { while (!maxPQ.isEmpty()) { Pair top = maxPQ.peek(); if (keyCount.containsKey(top.key) && keyCount.get(top.key) == top.count) { return top.key; } maxPQ.poll(); } return ""; } public String getMinKey() { // Ensure the top of the minPQ has the correct count in the hashmap while (!minPQ.isEmpty()) { Pair top = minPQ.peek(); if (keyCount.containsKey(top.key) && keyCount.get(top.key) == top.count) { return top.key; } minPQ.poll(); // Remove outdated entries } return ""; // Return empty string if no element exists } }

  • @sushantsingh7924
    @sushantsingh7924 วันที่ผ่านมา

    great video bhaiya 👍 thanks

  • @Factmtech
    @Factmtech วันที่ผ่านมา

    Thank you Sir, I m a btech 1st year student and I hope you will help to get my dream job.😁

  • @rjshakti54
    @rjshakti54 วันที่ผ่านมา

    Bhaiya u r legend Pls guide me for sde I hope you will contact me❤❤❤

  • @DeshnaJain8
    @DeshnaJain8 วันที่ผ่านมา

    Hii sir I am just starting to learn java and has ko knowledge of the language, will this course be suitable for me as a beginner in java with dsa

  • @ujwal_2000
    @ujwal_2000 วันที่ผ่านมา

    Great content bro !!!

  • @ujwal_2000
    @ujwal_2000 วันที่ผ่านมา

    great cool stuff you are sharing bro...!!❤❤

  • @ujwal_2000
    @ujwal_2000 วันที่ผ่านมา

    Bhai zabardast content .... ❤❤

  • @krgtm
    @krgtm วันที่ผ่านมา

    Bahit khatarnak sawal de dkya aaj to 😢

  • @ujwal_2000
    @ujwal_2000 วันที่ผ่านมา

    ❤Great channel bro

  • @PiyushSharma-we8yd
    @PiyushSharma-we8yd 2 วันที่ผ่านมา

    bhaiya mujhe pta tha aur koi upload kre ya na kre aap design wala zaroor kroge😍

  • @shashwat_tiwari_st
    @shashwat_tiwari_st 2 วันที่ผ่านมา

    yr aaj ki video ke liye 150 like banta hai😮‍💨😮‍💨

    • @Roomates338
      @Roomates338 2 วันที่ผ่านมา

      SIr please try to upload,weekly contest solutions also ...Please

    • @ekantgaming
      @ekantgaming วันที่ผ่านมา

      @@Roomates338 yes please bhaiya

  • @nikhilmalhotra1986
    @nikhilmalhotra1986 2 วันที่ผ่านมา

    🩷

  • @ayushigadekar8920
    @ayushigadekar8920 2 วันที่ผ่านมา

    11/51 testcases passed... only

    • @shashwat_tiwari_st
      @shashwat_tiwari_st 2 วันที่ผ่านมา

      match your code with the attached code in description once.

  • @asifd102
    @asifd102 2 วันที่ผ่านมา

    Very good explanation bhai

  • @amanvishwakarma6394
    @amanvishwakarma6394 2 วันที่ผ่านมา

    Awesome

  • @muzammilshaikh9295
    @muzammilshaikh9295 2 วันที่ผ่านมา

    Great job!! Love this new way of teaching, would really appreciate if you follow the same for upcoming videos too!!

  • @RavikumarMandha-z6u
    @RavikumarMandha-z6u 2 วันที่ผ่านมา

    Can you explain bit more like in which algorithm pattern it falls under.. and So and so

  • @RavikumarMandha-z6u
    @RavikumarMandha-z6u 2 วันที่ผ่านมา

    Can you explain in English

  • @sourabhgarg2890
    @sourabhgarg2890 2 วันที่ผ่านมา

    keep doing good work

  • @ParikshitShrestha-o1z
    @ParikshitShrestha-o1z 2 วันที่ผ่านมา

    Perfect perfect perfect 😊❤

  • @PiyushSharma-we8yd
    @PiyushSharma-we8yd 2 วันที่ผ่านมา

    😍😍😍

  • @Real_Gangsta-q8h
    @Real_Gangsta-q8h 2 วันที่ผ่านมา

    Bhai aap boht he tagda pdha rhe ho ! Ye logic building itni strong kaise hogi ?

  • @shashwat_tiwari_st
    @shashwat_tiwari_st 2 วันที่ผ่านมา

    having little cold, so sorry for late video! But video achi lage toh share like jarur kre ❤

  • @ParikshitShrestha-o1z
    @ParikshitShrestha-o1z 3 วันที่ผ่านมา

    Such humble and respectful person. Thank you sir🙏

  • @vickymahato4488
    @vickymahato4488 3 วันที่ผ่านมา

    after searching lots of content on youtube , finally a video where all concept explained very well , thank you sir for this amazing video , my lang is c++ but from the logic which you arer teaching is great ,

  • @avanishpandey1.0
    @avanishpandey1.0 3 วันที่ผ่านมา

    lecture 7 completed

  • @tejas2636
    @tejas2636 3 วันที่ผ่านมา

    What if one interval is ending at 5 where we insert {5 , -1}and another interval starting at 5 where we insert {5,+1} .. Will it work for such case.. Like in this case insertion and deletion at same point will make the count as 0.. Will it work for such cases..??

    • @shashwat_tiwari_st
      @shashwat_tiwari_st 3 วันที่ผ่านมา

      It will work because we check in a loop right. ex: (3,5) and (5,9) map: 3 -> 1 5 -> 0 9 -> 1 count will be 0 initially. Now you can iterate and check. 1st iteration count will be 1 (when 3 is checked means there is one event) 2nd iteration count will be 1 (previous 1 + value of 5 is zero) 3rd iteration count will be 2 (previous 1 + value of 9 is one) your doubt was in the second iteration but how will it be zero? see, that is why we take prefix sum. that -1 from ending 5 was the +1 inserted by its starting moment not for next interval....

    • @tejas2636
      @tejas2636 3 วันที่ผ่านมา

      @@shashwat_tiwari_st Thank you sir.. Kuch naya sikhne koo mile firse..😇

  • @B-Billy
    @B-Billy 3 วันที่ผ่านมา

    plz include problem title in videos title as well. It helps! Example : LeetCode -19 : Remove Nth Node From End of List.

  • @PiyushSharma-we8yd
    @PiyushSharma-we8yd 4 วันที่ผ่านมา

    😍😍

  • @shashwat_tiwari_st
    @shashwat_tiwari_st 4 วันที่ผ่านมา

    Two corrections 1) 7:21 start>=end means interval does not exist,I missed explaining start == end case because end is exclusive range example [20,20] is invalid because range is actually 20 to 19 which is invalid. where as [16,20] is valid as the range is 16 to 19 2) 12:12 name of the algorithm is Line Sweep. Like target is 130, Please do like if you were able to understand the explanation as well as the code.