Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company.Recursion.problems;
- import java.util.ArrayList;
- import java.util.Scanner;
- public class Numerology2 {
- public static void main(String[] args) {
- Scanner input = new Scanner(System.in);
- String num=input.nextLine();
- ArrayList<Integer>numbers=new ArrayList<>();
- for (int i = 0; i < num.length(); i++) {
- numbers.add(num.charAt(i)-'0');
- }
- ArrayList<Integer>result=new ArrayList<>(numbers);
- calculate(0,8,numbers,result);
- }
- private static void calculate(int index,int length, ArrayList<Integer> numbers,ArrayList<Integer> result) {
- if(result.size()==1){
- countRep(result);
- }else{
- for (int i = index+1; i <result.size() ; i++) {
- sum(result.get(index),result.get(index+1));
- calculate(index,length-1,numbers,result);
- }
- }
- }
- private static Integer sum(Integer integer, Integer integer1) {
- }
- private static int[] countRep(ArrayList<Integer> result) {
- int[]counting=new int[10];
- for (int i = 0; i <result.size() ; i++) {
- for (int index = 0; index < counting.length; index++) {
- if (result.equals(index)) {
- counting[index]++;
- }
- }
- }
- return counting;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment