Codechef Starters 145 Contest Explanation | Gun Master | Make My Array Equal | Make Bob Win Python

Поділитися
Вставка
  • Опубліковано 17 вер 2024

КОМЕНТАРІ • 4

  • @StrawDev
    @StrawDev Місяць тому +1

    bro in last question u didn't explain that how u generated that formula

    • @CodeBreakz
      @CodeBreakz  Місяць тому

      @@StrawDev basically it calculates the ascii value of 1st and last charecter of string we put base value as 2 and sum of 2 zero charecters and then subtracted the 0th char and the last char basically
      The formula is designed to calculate a result based on the ASCII values of the characters at the ends of the binary string, with adjustments and normalization factors. The min(..., n) ensures the result is within the length of the string, handling specific constraints or requirements of the problem.

  • @GrimReaper-qy1wz
    @GrimReaper-qy1wz Місяць тому

    Bro if array is 0 , 6 , 7 for 2nd question what should be the output? YES or NO

    • @CodeBreakz
      @CodeBreakz  Місяць тому

      It would be No
      Just a simple logic
      first number is 0 so we cant iterate through it
      2nd number is 6 so set b= { 6 : 1 }
      And count += 1 --> 1
      3rd number is 7 so set b = { 6:1 , 7:1 }
      And count +=1 --> 2
      Now finally our count total is 2 which is greater than 1
      Count > 1 so answer is No