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

แชร์
ฝัง
  • เผยแพร่เมื่อ 15 พ.ค. 2020
  • ✍️✍️ Register Here For Online Training : bit.ly/3Crpgbr
    ** 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

ความคิดเห็น • 25

  • @ashokit
    @ashokit  ปีที่แล้ว

    💡 Welcome to Ashok IT..!! 💡
    👉 Register Here For Online Training : bit.ly/3Crpgbr
    🔥 Download Android App : bit.ly/3Z2vXcO
    🔥 Download IOS App (MyInstitute) : apple.co/3IcEao3
    👉 ORG Code For IOS : CNFXJ
    🌐 Visit Our Website : ashokitech.com/

  • @jatinsharma3792
    @jatinsharma3792 5 หลายเดือนก่อน +4

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

  • @rptech6902
    @rptech6902 10 หลายเดือนก่อน +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

  • @Ravikumar-gj6qw
    @Ravikumar-gj6qw 2 ปีที่แล้ว +2

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

  • @dipikasharma748
    @dipikasharma748 3 ปีที่แล้ว +16

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

    • @mishra1576
      @mishra1576 3 ปีที่แล้ว +5

      Yes it should be😊

  • @jagadeeshbaskaran4881
    @jagadeeshbaskaran4881 2 ปีที่แล้ว

    Excellent . Thanks sir

  • @rajeevkalangi2472
    @rajeevkalangi2472 2 ปีที่แล้ว

    Thanks Bro. Your explanation is super cool.

  • @kameshwaran6689
    @kameshwaran6689 2 ปีที่แล้ว

    Really superb

  • @Ravikumar-gj6qw
    @Ravikumar-gj6qw 2 ปีที่แล้ว

    Tq Ashok bro

  • @ram8705
    @ram8705 หลายเดือนก่อน

    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;
    }
    }
    }

  • @ganeshbodduaddasuryanitinb7811
    @ganeshbodduaddasuryanitinb7811 3 ปีที่แล้ว

    Using index Of method?

  • @moumajhi23
    @moumajhi23 10 หลายเดือนก่อน

    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.

  • @DILEEPKUMAR-gp7ic
    @DILEEPKUMAR-gp7ic ปีที่แล้ว

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

  • @kkiran-zk8ed
    @kkiran-zk8ed 2 ปีที่แล้ว +3

    You can use j=i+1

    • @alokkumar-pl6ds
      @alokkumar-pl6ds 2 ปีที่แล้ว

      same doubt

    • @krishkhemani96
      @krishkhemani96 ปีที่แล้ว

      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 ปีที่แล้ว

      @@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.

  • @hchemlal
    @hchemlal ปีที่แล้ว +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 ปีที่แล้ว

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

    • @hchemlal
      @hchemlal ปีที่แล้ว

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

    • @krishkhemani96
      @krishkhemani96 ปีที่แล้ว +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.