8000 17/18 Sem 1 Q15(a) · Issue #379 · nus-cs2030/2021-s2 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

17/18 Sem 1 Q15(a) #379

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
lyntan01 opened this issue Apr 26, 2021 · 4 comments
Open

17/18 Sem 1 Q15(a) #379

lyntan01 opened this issue Apr 26, 2021 · 4 comments
Labels
🧠 Finals Q&A Questions related to Finals

Comments

@lyntan01
Copy link

Summary

Hi, why isn't the answer 4 instead of 26? I understood it as the question asking for the value of x, not the value of the entire statement. (Although technically x is a local variable so x has no value outside the stream)

Screenshot and Suggested Answer:

photo_2021-04-27 03 07 50

@lyntan01 lyntan01 added the 🧠 Finals Q&A Questions related to Finals label Apr 26, 2021
@Buwoo
Copy link
Buwoo commented Apr 27, 2021

1 passes into reduce: 0 x 2 + 1 = 1
new seed value: 1
2 passes into reduce: 1 x 2 + 2 = 4
new seed value: 4
3 passes into reduce: 4 x 2 + 3 = 11
new seed value: 11
4 passes into reduce: 11 x 2 + 4 = 26 (ans)

@darrylcjy
Copy link

I have the same thought as you. Felt like this question was not phrased that well.

@e0543492
Copy link

You are right. The question could have been phrased better.

@lyntan01
Copy link
Author
lyntan01 commented Apr 27, 2021

thanks guys! glad to know i wasn't the only one confused

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🧠 Finals Q&A Questions related to Finals
Projects
None yet
Development

No branches or pull requests

4 participants
0