POTD- 02/11/2023 | Minimum distance between two numbers | Problem of the Day GeeksforGeeks

Sdílet
Vložit
  • čas přidán 1. 11. 2023
  • Welcome to the daily solving of our PROBLEM OF THE DAY with Karan Mashru. We will discuss the entire problem step-by-step and work towards developing an optimized solution. This will not only help you brush up on your concepts of Data Structures and Algorithms but will also help you build up problem-solving skills.
    So come along and solve the GFG POTD of 02nd November 2023 with us!
    💻 Try it Yourself: www.geeksforgeeks.org/problem...
    Find daily solutions for POTD here on our channel! Make sure you are subscribed and stay updated.
    -----------------------------------------------------------------------------------------
    🏆 Take part in our Weekly Coding Contests: practice.geeksforgeeks.org/ev...
    📖 Master Competitive Programming - Complete Beginner to Advanced: practice.geeksforgeeks.org/co...
    -----------------------------------------------------------------------------------------
    Follow us and stay updated on everything happening in the world of geeks:
    📱 Twitter- / geeksforgeeks
    📝 LinkedIn- / geeksforgeeks
    🌐 Facebook- / geeksforgeeks.org
    📷 Instagram- geeks_for_g...
    #GFGPractice #GeeksforGeeks #ProblemofTheDay #CodingQuestions #POTD

Komentáře • 4

  • @saimani6410
    @saimani6410 Před 7 měsíci

    Can't we do using two pointers

  • @Sayan_Shankhari
    @Sayan_Shankhari Před 8 měsíci

    Sliding window?

  • @prateekbhaisora
    @prateekbhaisora Před 8 měsíci +1

    A cleaner code:
    int minDist(int arr[], int n, int x, int y) {
    int indx = -1, indy = -1;
    int ans = n+1;
    for (int i=0; i

    • @abhishekupadhyay9962
      @abhishekupadhyay9962 Před 3 dny

      int minDist(int a[], int n, int x, int y) {
      // code here
      int prev = -1;
      int minDist = INT_MAX;
      for(int i=0;i