All Questions
Tagged with set programming-challenge
6
questions
4
votes
1
answer
5k
views
Compute power set of a given set in Python
Problem:
Given a set (let's say of integers), return the list of all of its subsets also known as the power set.
It looks to be working, but I would like feedback on the algorithm and Python ...
3
votes
1
answer
964
views
Extract index of first unique element in large array in Swift
I'm using the following code to return the first index of a unique character in a large String. It works fine until I get to large strings, where it times out.
Is ...
2
votes
1
answer
8k
views
Remove Duplicates from Array in Swift 3.0
I ran the following code through a Leetcode.com challenge and it says the runtime for the test cases is 119ms, which puts it at the back of the pack performance wise.
The goal is to remove duplicates ...
3
votes
1
answer
1k
views
Calculate pairs in a Set ("Sherlock and Pairs" HackerRank challenge)
I have started reading clean code and want to improve my coding practices. Here is my attempt at solving an online puzzle. Please review the code and let me know how could I have written it better in ...
2
votes
1
answer
169
views
Dealing with input and output in Matlab
I just wrote a program which performed some elementary set operations as you can see below. It's the first time I have used input and output of text files so I am mainly looking for critique on that, ...
8
votes
3
answers
3k
views
Two sets came to an intersection
Challenge:
Print set intersections.
Specifications:
Your program should accept as its first argument a path to a filename.
Each line in the file is a test case.
Each test case contain two ...