Français
Se connecter
Ouvrir dans Telegram

Fil de discussion [1,2,3 ]

5 messages · –
W
Web Development Bootcamp
[1,2,3 ] loop chalaya 3 nikaala ,,, usko 3 * 10^0 = 3 fir 2 * 10^1= 20 fir 1 * 10^2= 100 Now Add them 100 + 20 + 3 Add sath sath karte raho ek Sum variable banakar... for loop ka i =2 hoga toh ab 10 ki power 0 laani hai ... toh you will do like length - i-1 length = 3 mtlb i=2—> 3-2-1 = 0 fir i =1-» 3-1-1 =1 fir i=0—» 3-0-1 = 2 toh iss trha se 10 ki power banegii... Loop from right to left ————————————— 1,3,4,2 hai sum = 0; for( i = 3 to 0) sum += a[i] * pow(10,len - i -1); DRY RUN —-»» len =4 , sum = 0 i =3--» sum = 0 + 2* pow(10,4-3-1)-»2 i =2--» sum = 2 + 4* pow(10,4-2-1)-» 42 i =1--» sum = 42 + 3* pow(10,4-1-1)-» 342 i =0--» sum = 342 + 1* pow(10,4-0-1)-» 1342 I hope samjh jaoge ... Chaho toh iss array ko string me daalo or string ko Integer banado ..JavaScript Python me esa karna easy hai ....
  1. D
    thank you bhay, ekdam mast approach h, me bar bar parse krte hi reh gya tha ;_;
    1. W
      Web Development Bootcamp
      Hahha 🤞 Just 3 to 4 lines of code...
        1. W
          Web Development Bootcamp
          Welcome
WWeb Development BootcampWeb Development Bootcamp@WebDevCoursesJavaScript · groupe
724membres4écrivent en 30 jours
Fil de la communauté Ouvrir dans Telegram

Un fil public ouvert issu de l'index de recherche ChatCrawler — « le Google du Telegram public » ; actualisé à mesure que la communauté est explorée. Les heures sont en UTC.

Contenu public uniquement, API officielle de Telegram. À propos · FAQ · Limites de l'index · Retirer une page · Catalogue · Recherche · Comment nous comptons