id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

gaurav.gupta@mq.edu.au arrays > oneInEachSubArray
prev  |  next  |  chance

Define a function that when passed an integer array and a second integer representing the number of sub-arrays in which it should be divided (assume it can be divided evenly), returns true if there is at least one common item in every sub-array, false otherwise.


oneInEachSubArray([20, 20, 20, 20], 2) → true
oneInEachSubArray([20, 20, 20, 10, 10, 10], 2) → false
oneInEachSubArray([10, 70, 20, 90, 50, 80, 60, 10, 20, 10, 100, 70], 3) → true

...Save, Compile, Run (ctrl-enter)

boolean oneInEachSubArray(int[] a, int n) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 5 Post-solution available

Copyright Nick Parlante 2017 - privacy