Problem Description Link
Algorithm
This is the simple string related problem. You can solve easily using your defined string adding function. you need first
reverse the string that you entered and add two string. after adding print the result reveser order. You must
Omit any leading zeros in the output.
You no need reverse the inputs if you adding atart from left most. but you nee create same length two string by insert 0.
For Example:
a=4358
b=754
length not same so create same length add 0 in b at right most
b=7540
now add
a=4358
b=7540
-----------
r=1998 this is the result
if a=305 and b= 794
add
a=305
b=794
---------------
r= 0001 so you need avoid all leftmost 0 s, so 1 is the result.
Algorithm
This is the simple string related problem. You can solve easily using your defined string adding function. you need first
reverse the string that you entered and add two string. after adding print the result reveser order. You must
Omit any leading zeros in the output.
You no need reverse the inputs if you adding atart from left most. but you nee create same length two string by insert 0.
For Example:
a=4358
b=754
length not same so create same length add 0 in b at right most
b=7540
now add
a=4358
b=7540
-----------
r=1998 this is the result
if a=305 and b= 794
add
a=305
b=794
---------------
r= 0001 so you need avoid all leftmost 0 s, so 1 is the result.
No comments:
Post a Comment
Write your comment - Share Knowledge and Experience