TCS Digital - Advanced Coding | Pangram Strings | Daily Dose Ep-27 | Tamil | code io

แชร์
ฝัง
  • เผยแพร่เมื่อ 18 ม.ค. 2025

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

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

    for bothsolutions we can add a condition to whether the given string has 26 characters and if not we can return false.
    if(s.length() < 26) return false;
    a small optimisation.

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

    Bro yeepdi 97 subtraction panna index kedaikuthu please sollunga

    • @inaminam9080
      @inaminam9080 ปีที่แล้ว +1

      The ASCII value of A is 97
      if we subract with any other character, we can get its actual number count, here it is used to store count in array so he used 97, we can also use 96 generally
      eg: a=97, if we subract b-97, we get 1,ie. 98-97=1

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

    O(26) thana?
    A to Z vara thana store agum

    • @codeio
      @codeio  3 ปีที่แล้ว +1

      Exactly evlo memory store aagum nu paatha 26 units of memory. Aana complexity nu namma yosikkura apa proportional ah yosippom, so 2N nu irrunthalum O(N) nu than solluvom we'll drop the coefficient always.
      Inga input string oda size ennvaa irrunthalum namma use panra array oda size is always 26 , constant.
      So constant space na namma O(1) nu than solluvom, as we drop than coefficient in calculating complexity.

  • @nthgtosay..6860
    @nthgtosay..6860 ปีที่แล้ว

    import java.util.Scanner;
    import java.util.Arrays;
    public class pangram {
    public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String str = sc.nextLine();
    String nstr = str.replaceAll("\\s", "").toLowerCase();
    char[] arr1 = nstr.toCharArray();
    Arrays.sort(arr1);
    char[] arr = new char[26];
    for (int i = 0; i < 26; i++) {
    arr[i] = (char) ('a' + i);
    }
    boolean isOk = Arrays.equals(arr, arr1);
    if (isOk) {
    System.out.println(" Pangram");
    } else {
    System.out.println("Not a pangram");
    }
    }
    }
    intha code la yen bro correct ans vara matrathu ?

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

      bro in arr, u will store the duplicate characters, that means, if ur sttung has "cocon", two time c is stored
      This is what i think

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

    O(26)

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

      Thats right!!!! 👏👏👏👍

    • @codeio
      @codeio  3 ปีที่แล้ว +2

      But we conventionally use O(1) to denote constant space, as we ignore the coefficients when using Big O notation 😊😊

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

    O(1)

    • @codeio
      @codeio  3 ปีที่แล้ว +1

      Awesome na. 👏👏👏👏👏👏👍

  • @nithishkumark1644
    @nithishkumark1644 3 ปีที่แล้ว +1

    Constant space thana...?

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

      Yes na... Thats right

  • @ramji-nw3oh
    @ramji-nw3oh 3 ปีที่แล้ว

    0(1)

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

      That's right bro 👏👏👏👏👍

  • @SarathKumar-mf3xy
    @SarathKumar-mf3xy 7 หลายเดือนก่อน

    O(1)