bobby_k

Numerulogy

Jun 8th, 2018
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.37 KB | None | 0 0
  1. package com.company.Recursion.problems;
  2.  
  3. import java.util.ArrayList;
  4. import java.util.Scanner;
  5.  
  6. public class Numerology2 {
  7.     public static void main(String[] args) {
  8.         Scanner input = new Scanner(System.in);
  9.         String num=input.nextLine();
  10.         ArrayList<Integer>numbers=new ArrayList<>();
  11.  
  12.         for (int i = 0; i < num.length(); i++) {
  13.           numbers.add(num.charAt(i)-'0');
  14.         }
  15.         ArrayList<Integer>result=new ArrayList<>(numbers);
  16.         calculate(0,8,numbers,result);
  17.  
  18.     }
  19.  
  20.     private static void calculate(int index,int length, ArrayList<Integer> numbers,ArrayList<Integer> result) {
  21.         if(result.size()==1){
  22.             countRep(result);
  23.         }else{
  24.             for (int i = index+1; i <result.size() ; i++) {
  25.                 sum(result.get(index),result.get(index+1));
  26.                 calculate(index,length-1,numbers,result);
  27.             }
  28.         }
  29.     }
  30.  
  31.     private static Integer sum(Integer integer, Integer integer1) {
  32.  
  33.     }
  34.  
  35.     private static int[] countRep(ArrayList<Integer> result) {
  36.         int[]counting=new int[10];
  37.         for (int i = 0; i <result.size() ; i++) {
  38.             for (int index = 0; index < counting.length; index++) {
  39.                 if (result.equals(index)) {
  40.                     counting[index]++;
  41.                 }
  42.             }
  43.         }
  44.         return counting;
  45.     }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment