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

 

srp4379@lausd.net > firstElementsEqual
prev  |  next  |  chance

public boolean firstElementsEqual(int[] a, int[] b)

Given two arrays - a and b - both of whose lengths are at least 1,
return true if their first elements are the same.

public boolean firstElementsEqual(int[] a, int[] b) {
  boolean equals = false;
  if (a[0] == b[0]) {
    equals = true;
  }
  return equals;
}

firstElementsEqual([1, 2], [1, 5]) → true
firstElementsEqual([3, 7], [3, 2]) → true
firstElementsEqual([6, 7], [7, 6]) → false

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

public boolean firstElementsEqual(int[] a, int[] b) { }

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: 1

Copyright Nick Parlante 2017 - privacy