New answers tagged

0 votes

Codeforces #806 Problem D: Double Strings

Move solution into a separate function Doing this greatly improves code readability. ...
user avatar
  • 106
4 votes

Codeforces #806 Problem D: Double Strings

You are failing with the datastructures. What you need is: A string to mark your answers. Start with all no. A std::vector to collect your strings. A way to ...
user avatar
  • 17.8k
4 votes

Decibinary for xth number (Python code)

First there's some script cleanups I want to mention. ...
user avatar
4 votes
Accepted

Time limit error in 'The Minion Game' using python in Hacker Rank

The number of substrings with a fixed starting point is just the length of the remaining string. Also you might want to use the string module a bit + some literals instead of ord. Additionally ...
user avatar
2 votes

Find a secret word given an array of triplets? (codewars problem)

After some thought, I fixed some issues on the code: The most important change was realizing that I didn't have to loop through each char in the array. I only needed to do it for the first char of ...
user avatar
  • 131
1 vote
Accepted

USACO Training - Section 1.5 - Arithmetic Progressions

The link you provided for an optimization suggested using a Boyer-Moore like algorithm. That got me thinking about using string.find() and then ...
user avatar
  • 9,345
2 votes

USACO Training - Section 1.5 - Arithmetic Progressions

PEP-8: consider renaming to calculate_bisquares() and check_num(). Also, definitely make it lint clean with ...
user avatar
  • 5,798

Top 50 recent answers are included