All Questions
Tagged with programming-challenge python-2.x
93 questions
2
votes
1
answer
191
views
LeetCode 839: Similar String Groups III
I'm posting my code for a LeetCode problem. If you'd like to review, please do so. Thank you!
Problem
Two strings X and Y are similar if we can swap two letters (in different positions) of X, so that ...
5
votes
1
answer
99
views
Sorting software version list using Python 2.7 (no modules)
I am participating in a challenge and one of the challenges was to write a script to sort a list of software versions (ex: 1.0, 1.3.2, 12, 1.3.0). Here is the my solution:
...
13
votes
1
answer
6k
views
Google FooBar "Prepare The Bunnies Escape"
I'm currently working through the google FooBar challenge, and I'm on the third level, in which I have to find the distance between the top left and bottom right points on a grid. The grid is filled ...
17
votes
2
answers
3k
views
Roman to Integer
I'm trying to improve as a programmer and would love any feedback on my code- especially the section in the while loop. How could I make this more readable? What would your opinion as an interviewer ...
2
votes
3
answers
2k
views
Given a sorted array nums, remove the duplicates in-place
I wrote an algorithm to solve this challenge but would love some feedback on its efficiency and, if you were an interviewer, what your opinion would be on my solution. I believe my time complexity is \...
10
votes
1
answer
9k
views
Given a string, find the length of the longest substring without repeating characters
I wrote an algorithm that solves this problem but I would love to get some feedback on it (especially since I'm not so confident in my Big \$O\$ skills).
Do you think this is a good quality algorithm?...
3
votes
2
answers
2k
views
Maximum sub-array of non-negative numbers
This is the "Maximum sub-array" problem from CodeChef:
Find out the maximum sub-array of non negative numbers from an
array.
The sub-array should be continuous. That is, a sub-array
created ...
1
vote
1
answer
1k
views
The Substring Game! challenge
This is the Substring Game! challenge from HackerEarth:
Watson gives Sherlock a string (let's denote it by S). Watson calculates all the substrings of S in his favourite order.
According to the ...
4
votes
1
answer
1k
views
Genomic Range Query in Python
Recently, I worked on one of the Codility Training - Genomic Range Query (please refer to one of the evaluation report for the detail of the task.
The solution in Python is based on prefix sum, and ...
3
votes
0
answers
394
views
Python2.7 Some xor fun
After doing the Cryptopals challanges, which I found scrolling through codereview, and finally being able to solve set1 challenge 6. I decided to have a little xor fun, and make an automated xor ...
2
votes
2
answers
7k
views
Finding an increasing sequence from a given array in a time-efficient manner in Python
Problem Statement:
Given a sequence of integers as an array, we have to determine whether
it is possible to obtain a strictly increasing sequence by removing no
more than one element from the ...
3
votes
2
answers
737
views
Merging the frequency rankings of boys' names and girls' names
Problem statement:
The html pages for each year which represents the top 1000 most common Girl and Boy names in the order of their frequency are ranked and provided. And they are ranked based on the ...
5
votes
1
answer
334
views
AIO programming challenge - Friendlist - Who has the most friends?
I attempted this sample question from the Australia Infomatics Competition. TL;DR - Each line of input contains two numbers, representing a mutual friendship relationship. The output needs to be the ...
13
votes
2
answers
802
views
A classy DNA nucleobase counter
This question is part of a series solving the Rosalind challenges. For the previous question in this series, see Counting nucleobases in a nucleotide c. The repository with all my up-to-date solutions ...
5
votes
2
answers
848
views
Zigzag Iterator
I've recently solved the LeetCode's "ZigZag iterator" problem:
Given two 1d vectors, implement an iterator to return their elements
alternately.
For example, given two 1d vectors:
...