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

 

gaurav.gupta@mq.edu.au strings > subtract
prev  |  next  |  chance

Define a function that when passed two Strings, each holding a (possibly very very long integer) as a String, returns the difference between the two numbers, as a String.

You may assume that both numbers are positive (more than zero), and the first number is greater than or equal to the second.

NOTE: The strings can be very very very very long so don't even try to convert them to integers.


subtract("8703575", "4876045") → "3827530"
subtract("97", "21") → "76"
subtract("13", "8") → "5"

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

String subtract(String a, String 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: 6 Post-solution available

Copyright Nick Parlante 2017 - privacy