Java Program To Find First Non Repeated Character | Java | Ashok IT

Sdílet
Vložit
  • čas přidán 7. 09. 2024
  • ✍️✍️ Register Here For Online Training : bit.ly/4dBYJbX
    ** For Online Training ► Call: +91-6301921083
    Subscribe to our channel and hit the bell 🔔🔔🔔 icon to get video updates.
    💡 Visit Our Website
    For Online Training: www.ashokit.in
    💡 About Ashok IT :
    Ashok IT is the No.1 quality training institute in India for the candidates who want to build their future in Information Technology. We are into online training, class room training, corporate training and one to one training with more passion and dedication. Ashok IT aims in providing best quality realtime oriented trainings on C, C++, Java, Spring , Spring REST, Spring Cloud, Microservices, Python, DJango, .Net, Angular, React JS, Salesforce, , Testing, Android, Docker, Kubernates, Manual Testing, Selenium and Digital Marketing.
    -----------------------------------------------------------------------------------
    💡 Our Online Training Features
    🎈 Training with Real-time Working Professionals
    🎈 Industry Matching use cases
    🎈 Live Coding
    🎈 Real-time Environment
    🎈 Class Notes
    🎈 Doubts Clarifications in Each Session
    -----------------------------------------------------------------------------------
    💡 Contact details:
    ☎ WhatsApp Number: +91-6301921083
    ► Website : www.ashokit.in
    ► Join with us in Telegram : bit.ly/3iP2KyA
    ► Like us in Facebook : bit.ly/3dw6R0A
    ► Follow us in Instagram : bit.ly/3jzEKl8
    ► Follow us in Twitter : bit.ly/2SDqdK4

Komentáře • 29

  • @ashokit
    @ashokit  Před rokem

    🔥 Welcome to Ashok IT..!!
    👉 Register Here For Online Training : bit.ly/4dBYJbX
    👉 Follow us in Instagram : bit.ly/3jzEKl8
    👉 Follow Us in WhatsApp : bit.ly/49wCWje
    👉 Visit Our Website : ashokit.in/

  • @rptech6902
    @rptech6902 Před rokem +2

    public class practicee {
    public static void main(String args[])
    {
    String s="AABCDBE";
    int count=0;
    char[] k =s.toCharArray();
    for (int i = 0; i < k.length; i++) {
    for (int j = 0; j < k.length; j++) {
    if (k[i]==k[j]) {
    count++;
    }

    }
    if (count==1) {
    System.out.println(k[i]);
    break;
    }
    count=0;
    }
    }
    }
    this is my approach

  • @dipikasharma748
    @dipikasharma748 Před 3 lety +16

    Shouldn't the map be LinkedHashMap so that it maintains the insertion order to correctly identify first non-repeated character?

  • @YashSingh-xs5yj
    @YashSingh-xs5yj Před dnem

    Collection approach is the best ❤

  • @Ravikumar-gj6qw
    @Ravikumar-gj6qw Před 2 lety +2

    Ur way of explaining or teaching is excellent 👌😉bro superb 👌👍👏, nobody is there ...

  • @jatinsharma3792
    @jatinsharma3792 Před 7 měsíci +4

    In hashMap the insertion order is not maintain, how can you be sure it will give your the First Non Repeated Char boss ????

    • @ashokit
      @ashokit  Před měsícem

      please contact our admin team : +91 9985396677

  • @ram8705
    @ram8705 Před 3 měsíci

    My approach :
    String unique = "AABDCE";
    for (int i = 0; i < unique.length(); i++) {
    for (int j = i+1; j < unique.length(); j++) {
    if(unique.charAt(i) != unique.charAt(j)) {
    System.out.println("1st non repeating char is : "+unique.charAt(j));
    return;
    }
    }
    }

  • @DanishAli-ql1es
    @DanishAli-ql1es Před 17 dny

    Very nice explanation

  • @rajeevkalangi2472
    @rajeevkalangi2472 Před 2 lety

    Thanks Bro. Your explanation is super cool.

  • @jagadeeshbaskaran4881
    @jagadeeshbaskaran4881 Před 2 lety

    Excellent . Thanks sir

  • @kameshwaran6689
    @kameshwaran6689 Před 2 lety

    Really superb

  • @kkiran-zk8ed
    @kkiran-zk8ed Před 2 lety +3

    You can use j=i+1

    • @alokkumar-pl6ds
      @alokkumar-pl6ds Před 2 lety

      same doubt

    • @krishkhemani96
      @krishkhemani96 Před rokem

      I don't think j=i+1 would work because in that case first iteration A and A would be compared in second iteration A and b would be compared and thus compiler would declare A as the first non repeating character.I am also not sure.

    • @garvitrangi3263
      @garvitrangi3263 Před rokem

      @@krishkhemani96 if we take j = i+1 then it will consider the last duplicate character as the first non-repeating character for eg It will consider 'A' of index 1 as a non-repeating character.

  • @moumajhi23
    @moumajhi23 Před 11 měsíci

    using this collection approach it won't give correct output , if the non repeated occurs at the first position , for example input = "kaabcdbe" output should be k but it would give c.

  • @Ravikumar-gj6qw
    @Ravikumar-gj6qw Před 2 lety

    Tq Ashok bro

  • @ganeshbodduaddasuryanitinb7811

    Using index Of method?

  • @DILEEPKUMAR-gp7ic
    @DILEEPKUMAR-gp7ic Před 2 lety

    It is coming last non repeated char we need first non repeated characters

  • @hchemlal
    @hchemlal Před rokem +1

    Your coding still needs some polishing, first approach you should have used j=i+1 and the second approach you should have used LinkedHashMap.

    • @anbuv.g.k495
      @anbuv.g.k495 Před rokem

      Yeass bro and the hashmap does not maintain insertion order right? How he got the answer bro..!

    • @hchemlal
      @hchemlal Před rokem

      @@anbuv.g.k495 It will work 90% of the time, but in production setting you'll face reality.

    • @krishkhemani96
      @krishkhemani96 Před rokem +1

      I don't think j=i+1 would work because in that case first iteration A and A would be compared in second iteration A and b would be compared and thus compiler would declare A as the first non repeating character.I am also not sure.