Тёмный

How To Solve Find Digits HackerRank Problem | HackerRank Solution 

JAVAAID - Coding Interview Preparation
Подписаться 38 тыс.
Просмотров 10 тыс.
50% 1

Опубликовано:

 

27 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 11   
@JavaAidTutorials
@JavaAidTutorials 5 лет назад
Hello Coding Lover, If you have any doubts or any better approach to solve this hackerrank problem, let me know in comments.
@sunnysharma5635
@sunnysharma5635 4 года назад
This code give run time error
@JavaAidTutorials
@JavaAidTutorials 4 года назад
which code? can you please post the code here.
@abhishekthesmoothoperator90
@abhishekthesmoothoperator90 4 года назад
static int findDigits(int n) { int temp=n; int count=0; while(temp>0){ int rem=temp%10; try{ if(rem!=0 && n%rem==0){ count++; }} catch(Exception e){ continue; } temp/=10; } return count; }
@abhishekthesmoothoperator90
@abhishekthesmoothoperator90 4 года назад
@@JavaAidTutorials static int findDigits(int n) { int temp=n; int count=0; while(temp>0){ int rem=temp%10; try{ if(rem!=0 && n%rem==0){ count++; }} catch(Exception e){ continue; } temp/=10; } return count; }
@JavaAidTutorials
@JavaAidTutorials 4 года назад
I just tried pasting you code on hackerrank. its passing all TCs. Let me know if you have some other doubts?
@shrikantlal2959
@shrikantlal2959 4 года назад
This code will only pass the sample test case
@JavaAidTutorials
@JavaAidTutorials 4 года назад
Try using exactly the same code without any modification
@abhishekthesmoothoperator90
@abhishekthesmoothoperator90 4 года назад
static int findDigits(int n) { int temp=n; int count=0; while(temp>0){ int rem=temp%10; try{ if(rem!=0 && n%rem==0){ count++; }} catch(Exception e){ continue; } temp/=10; } return count; }
@neharai4959
@neharai4959 2 года назад
Hi, n%r is not giving 0, like 10234%4! =0, can u please explain this line