Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Use this tag when the code is a solution to a programming challenge. Always include a sufficient description of the problem to be solved - while a link to the challenge is welcome, the review request needs to be complete when the challenge site is unavailable.
4
votes
Accepted
Split word based on terms from an array
The goal when writing code should almost always be to optimize for readability. Only worry about performance when you have a known performance bottleneck. Readable code can always be rewritten to be p …
2
votes
Accepted
SPOJ Adding reversed number in Java
First, note that this review is of general good coding practices for production code, and not all suggestions will be appropriate for the sphere of "competitive programming", in which I have no signif …
2
votes
Heaping up with the inqueries
I had no problems using a SortedSet, which is both more clear and more efficient than your implementation. You should use Scanner#nextInt() instead of parsing strings yourself.
I'm currently on a Ja …
2
votes
Outputting every second char in half string
It's a better practice to return the List of results rather than making it a class varible.
You still have IO tied into your program logic. You just moved it.
There's some disagreement on whether or …
4
votes
Tape Equilibrium O(n)
Correctness
I assume this is a toy problem and you don't need to worry about overflow/underflow? If you do, you should be using longs to do all your math, and either returning a long or casting back t …
8
votes
Find if the string contains ALL the vowels
Implementation
You only need to go through the array one time. Keep track of whether or not you've found each vowel, then return based on the results. You can return early if you find all five, and yo …
5
votes
Repeated Strings Hacker Rank challenge
If your goal is to optimize efficiency, you can do a little better by only looking at each character in the string once. The first remainder characters of the string will occur quotient + 1 times. The …
5
votes
Accepted
Check correctness of brackets in file with stack + error detection
Implementation
You don't need to catch anything other than IOException. You're not doing math, you're not formatting numbers, and you should virtually never catch Exception.
It's often a good idea t …
4
votes
Pig Latin Anslatortray
Your leading whitespace is much smaller than is typical. Prefer 4 spaces for a level of indent.
In java we typically put the curly brace { on the same line. If you insist on doing it on a new line, d …
3
votes
Optimal burger-eating challenge
General
It's a good idea to give it a day or two before you accept an answer. Accepting too early discourages other people from answering.
Use @Override when overriding methods in a parent type. Thi …
2
votes
Accepted
Pancake sort inteview using java
Flip
Use better variable names. i and j are harder to read than something like front and back.
It's preferable to define the temp value inside the loop and save a line of code.
The method should be …
5
votes
Counting ambiguous Morse Code encodings, with and without Java Streams
I'm going to skip commenting on the streaming approach because @Koekje has it covered. As far as the non-streaming approach:
morseMap is unused and should be removed
morseWords should be a class var …