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

 

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

Write a method that accepts the length and width of a grid of X's. Return the number of X's that lie on the border. For exmaple: XXXX XXXX XXXX has 10 X's on the border. Here I have changed the X's on the border to O's: OOOO OXXO OOOO Notice that a 2 by 2 grid of X's is ALL border: XX XX Border marked with O's: OO OO Note that length and width will each be at least one.


borderSize(1, 5) → 5
borderSize(3, 1) → 3
borderSize(1203, 1) → 1203

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

public int borderSize(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: 240

Copyright Nick Parlante 2017 - privacy