Skip to content
This repository was archived by the owner on May 18, 2022. It is now read-only.

Added Splitwise Code#9

Open
bsaik7 wants to merge 1 commit intoworkattech:masterfrom
bsaik7:master
Open

Added Splitwise Code#9
bsaik7 wants to merge 1 commit intoworkattech:masterfrom
bsaik7:master

Conversation

@bsaik7
Copy link
Copy Markdown

@bsaik7 bsaik7 commented Sep 22, 2019

Hi Gaurav,

I am Sai Krishna from Flipkart. I am trying for conversion to SDE1 from PSE3 in this November. You Machine Coding Article was helping in my preparation. Kindly review my splitwise code and please provide comments on whether this is enough for SDE1?

}

public void splitBalance(String command) {
String[] expensedata=command.split(" ");
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should keep input parsing outside of core logic

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your execute command would have been a good candidate for parsing and passing an object here.


boolean isValidCommand(String expensedata[],String expenseType,int usersInvolved)
{
int sum=0;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should keep separation between different types of expenses. Let's say a new expenseType comes, you'll have to change a lot of your existing methods which should be avoided as much as possible

@gcnit
Copy link
Copy Markdown
Collaborator

gcnit commented Oct 4, 2019

@bsaik7 sorry for the delay! Was busy at work.

Code looks good for SDE1 in my opinion!

Gave a few comments. Please check.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants