#How do I go from here?

1 messages · Page 1 of 1 (latest)

scenic rose
#
import java.util.*;
  import java.io.*;
  
  public class Main {
    public static void main(String[] args) throws Exception {
      Scanner f=new Scanner(System.in);
      int N=f.nextInt();
      int M=f.nextInt();
      int K=f.nextInt();
      int []ar=new int[N];
      int []hierarchy=new int[M];
      for(int i=0; i<M; i++){
        hierarchy[i]=f.nextInt();
      }
      for(int i=0; i<K; i++){
        int num=f.nextInt();
        int pos=f.nextInt()-1;
        ar[pos]=num;
      }

    }
  }

So i've essentailly established the numbers that have fixed positions in the array and need to find the earliest position 1 can be put whil also keeping in mind that 4 5 6 need to be in order(numbers can be between them). How would I do this?

clever hamletBOT
#

This post has been reserved for your question.

Hey @scenic rose! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.