Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Efficiency#732

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
yanglbme merged 2 commits intoTheAlgorithms:masterfrommarkettes:patch-1
May 10, 2019
Merged

Efficiency#732

yanglbme merged 2 commits intoTheAlgorithms:masterfrommarkettes:patch-1
May 10, 2019

Conversation

markettes
Copy link
Contributor

Just two small things that in case the number was very big could be helpful.

Just two small things that in case the number was very big could be helpful.
@markettes
Copy link
ContributorAuthor

I have been testing both ways to do it measuring time. Both are very fast and truly this pull request doesn't fix anything very important, but when the computer is working in other things and interrupts the thread, in your case you have a small delay. On the other hand, my solution makes it an atomic operation.
Thanks.

@@ -24,8 +24,8 @@
public static String encode(String message, int shift) {
String encoded = "";

while (shift >= 26) { // 26 = number of latin letters
shift -= 26;
if (shift >= 26) { // 26 = number of latin letters

Choose a reason for hiding this comment

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

Good catch! In fact, even thisif is not necessary, since the modulo operation is no-op ifshift < 26, i.e.

shift % 26 == shift if 0 <=shift < 26

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Oh! That's true! Less code then :)

@havanagrawal
Copy link

havanagrawal commentedMay 2, 2019
edited
Loading

LGTM :)

markettes reacted with laugh emoji

@yanglbmeyanglbme merged commit8d1a81b intoTheAlgorithms:masterMay 10, 2019
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@havanagrawalhavanagrawalhavanagrawal left review comments

@yanglbmeyanglbmeyanglbme approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@markettes@havanagrawal@yanglbme

[8]ページ先頭

©2009-2025 Movatter.jp