educative.io

More concise with Java 8

  public int findMSIS(int[] nums) {
      int[] dp = nums.clone();
      for (int i = 0; i < nums.length; i++) {
        for (int j = 0; j < i; j++) {
          if (nums[i] > nums[j]) {
            dp[i] = Math.max(dp[i], dp[j] + nums[i]);
          }
        }
      }
      return IntStream.of(dp).max().orElse(0);
  }

Hi @NorthSanJose

Hope you are doing well. The code looking good but not working, maybe it’s not compatible with the platform.