Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
|
|
@ -2,12 +2,10 @@ public class SelfDescribingNumbers{
|
|||
public static boolean isSelfDescribing(int a){
|
||||
String s = Integer.toString(a);
|
||||
for(int i = 0; i < s.length(); i++){
|
||||
String s0 = s.charAt(i) + "";
|
||||
int b = Integer.parseInt(s0); // number of times i-th digit must occur for it to be a self describing number
|
||||
int b = (int) s.charAt(i) - (int) '0';
|
||||
int count = 0;
|
||||
for(int j = 0; j < s.length(); j++){
|
||||
int temp = Integer.parseInt(s.charAt(j) + "");
|
||||
if(temp == i){
|
||||
if( i == (int) s.charAt(j) - (int) '0' ){
|
||||
count++;
|
||||
}
|
||||
if (count > b) return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue