Redian新闻
>
use credit card to fund a bank account(initial deposit when open an account online)
avatar
use credit card to fund a bank account(initial deposit when open an account online)# Money - 海外理财
f*m
1
题目如下。
我的问题:
如何理解提示中的最后一句话:“ You would then have to re-design the function
(ie, add an extra parameter).”加什么样的extra parameter?
谢谢。
题目:
Reverse digits of an integer.
Example1: x = 123, return 321
Example2: x = -123, return -321
Have you thought about this?
Here are some good questions to ask before coding. Bonus points for you if
you have already thought through this!
If the integer's last digit is 0, what should the output be? ie, cases such
as 10, 100.
Did you notice that the reversed integer might overflow? Assume the input is
a 32-bit integer, then the reverse of 1000000003 overflows. How should you
handle such cases?
Throw an exception? Good, but what if throwing an exception is not an option
? You would then have to re-design the function (ie, add an extra parameter).
avatar
V*6
2
suppose I set the cash advance limit for the credit card as $700. If I use
the cc to fund $1k to a bank account, will the transaction be reject? Any
bad effect if got rejected?
Thanks!
avatar
f*m
3
顶。

function

【在 f*********m 的大作中提到】
: 题目如下。
: 我的问题:
: 如何理解提示中的最后一句话:“ You would then have to re-design the function
: (ie, add an extra parameter).”加什么样的extra parameter?
: 谢谢。
: 题目:
: Reverse digits of an integer.
: Example1: x = 123, return 321
: Example2: x = -123, return -321
: Have you thought about this?

avatar
e*e
4
和算法没关吧。我想可能是一旦有错误(overflow)发生,因为不能抛出异常,需要一个
extra parameter来记录错误信息的。例如,extra parameter可以是个List类。

function

【在 f*********m 的大作中提到】
: 题目如下。
: 我的问题:
: 如何理解提示中的最后一句话:“ You would then have to re-design the function
: (ie, add an extra parameter).”加什么样的extra parameter?
: 谢谢。
: 题目:
: Reverse digits of an integer.
: Example1: x = 123, return 321
: Example2: x = -123, return -321
: Have you thought about this?

avatar
l*a
5
why get a list?
大概是这样吧?
bool reverse(int input, int* output,int* error)
{
if(overflow)
{
*error=ERROR_OVER_FLOW;
return false;
}
if(***) {
*error=****;
return false;
}

*output=***;
return true;
}

类。

【在 e****e 的大作中提到】
: 和算法没关吧。我想可能是一旦有错误(overflow)发生,因为不能抛出异常,需要一个
: extra parameter来记录错误信息的。例如,extra parameter可以是个List类。
:
: function

avatar
f*m
6
哦,了解,多谢各位。我以为要什么特殊的算法或design pattern。
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。