About 50 results
Open links in new tab
  1. How to create a sub array from another array in Java?

    How to create a sub-array from another array? Is there a method that takes the indexes from the first array such as: methodName(object array, int start, int end) I don't want to go over making loo...

  2. How to get a sub array of array in Java, without copying data?

    Aug 3, 2010 · There is no real way to wrap any data without copying and receive real array in Java. You just cannot create new array over existing memory. You have basically 2 options: Use methods that …

  3. Get only part of an Array in Java? - Stack Overflow

    The length of an array in Java is immutable. So, you need to copy the desired part into a new array. Use copyOfRange method from java.util.Arrays class:

  4. How to get 2D subarray from 2D array in JAVA? - Stack Overflow

    How to get 2D subarray from 2D array in JAVA? Asked 12 years, 9 months ago Modified 4 years, 7 months ago Viewed 18k times

  5. arrays - Definition of subarray - Stack Overflow

    Mar 14, 2011 · A subarray is a contiguous (consecutive) portion of an array. It is a subset of elements taken from the original array, maintaining their relative order. In simpler terms, a subarray is formed …

  6. java - Algorithm to generate all Subarrays from initial Array - Stack ...

    Oct 17, 2022 · Every subarray serves as a blueprint for another subarray in case if there are some unused elements left. Each single-element subarray produces a new branch of subarrays (if there …

  7. java - Get all subarrays from an array using a single loop - Stack Overflow

    I was wondering if there is an algorithm / pattern where someone could get/parse all subarrays of a given array using for example a simple loop. For example: for the array myArray{0,1,2,3} I ...

  8. java - Finding the subarray with the Maximum sum in the given …

    Mar 23, 2022 · The problem description: Given an ArrayList of Integers. Find a subarray with the maximum sum of any potential subarray within the ArrayList. A subarray a is a combination of …

  9. Difference between subarray, subset & subsequence - Stack Overflow

    May 17, 2015 · A subarray is a contiguous part of an array and maintains a relative ordering of elements. For an array/string of size n, there are n* (n+1)/2 non-empty subarrays/substrings.

  10. java - To find Maximum Average Subarray - Stack Overflow

    Oct 20, 2023 · This is a Leetcode problem, You are given an integer array nums consisting of n elements, and an integer k. Find a contiguous subarray whose length is equal to k that has the …