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

 

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

Your goal is to determine how many "long diagonals" would be traversed in a 'length' by 'width' rectangular array, if that array was being "traversed diagonally". Examples explaining "long diagonals" and what it means to be "traversed diagonally" are provided on paper. Please refer to the paper examples and instructions. Please DO NOT write on the paper copies. You have scrap paper to write on instead. As preconditions, you may assume that 'length' and 'width' are both greater than 1. For example, if 'width' is 9 and 'length' is 4, the number of long diagonals in the traversal would be 6. If 'width' is 25 and 'length' is 24, the number of long diagonals in the traversal would be 2.


test2022_10_06_HL_howManyLongDiagonals(54, 13) → 42
test2022_10_06_HL_howManyLongDiagonals(84, 24) → 61
test2022_10_06_HL_howManyLongDiagonals(2, 2) → 1

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

public int test2022_10_06_HL_howManyLongDiagonals(int length, int width) { }

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

Copyright Nick Parlante 2017 - privacy