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

 

jebbert@volusia.k12.fl.us > test2023_12_07_HL_pathFinder
prev  |  next  |  chance

Given a one-dimensional array of integers that represents a square matrix of integers, determine if there is a horizontal or vertical "path" from one end to the other end. Return true if at least one path exists, and return false if no such path exists. A "path" will consist of all zeros in a single horizontal row or vertical column. For example, pathExists({0,0,8,1,0,4,0,3,0}) returns false because it represents the matrix: 0 0 8, 1 0 4, 0 3 0 which does NOT have a horizontal or vertical "path" of zeros. However, if the 3 had been a 0, or if the 8 had been a zero, the method would return true since a path would exist in either of those cases. The array will contain at least one number. NOTE: The matrix representation is supposed to be a square 3 by 3 grid of numbers but I cannot make it appear correctly in JavaBat.


test2023_12_07_HL_pathFinder([0, 3, 1, 0]) → false
test2023_12_07_HL_pathFinder([0, 6, 0, 7]) → true
test2023_12_07_HL_pathFinder([0, 8, 5, 0, 1, 0, 0, 0, 0, 0, 0, 6, 0, 4, 0, 1]) → false

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

public boolean test2023_12_07_HL_pathFinder(int[] nums) { }

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

Copyright Nick Parlante 2017 - privacy