Skip to main content

All Questions

5 votes
4 answers
948 views

Decrease Computation Time for Python Tic-Tac-Toe Minimax Algorithm

Background I am currently participating in a tic-tac-toe coding challenge. During their move, each participant is given the board state and their team, X or O. The blank board is: ...
DapperDuck's user avatar
2 votes
1 answer
184 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 ...
Emma's user avatar
  • 3,592
2 votes
2 answers
178 views

Python - Hexadecimal to Decimal conversions

I have written a python 2 program for a school project to convert from hexadecimal to decimal without using built-in functions and vice versa in python. I would like to know how I can make my code ...
myang0630's user avatar
  • 564
1 vote
3 answers
62 views

`set_includes` (string subsequence-containment) in Python 2

I've implemented C++'s std::includes algorithm in Python, so that I can use it to efficiently implement a Scrabble "can I make this word" function: ...
Quuxplusone's user avatar
  • 19.5k
2 votes
2 answers
2k views

Heap Sort Implementation in Python

Objective: Create a heap sort that returns a unsorted list to sorted from greatest to least. Does this implementation look correct? Do you have any tips for optimizing this? ...
Johnathan's user avatar
  • 131
8 votes
3 answers
188 views

Python methods to reduce running times KTNS algorithm

I have been trying to develop an algorithm called keep the tool needed soonest (for more information about the KTNS explanation (page 3)) but during the simulations, I have realized that it takes too ...
A.Piquer's user avatar
  • 195
4 votes
1 answer
180 views

2D discrete motion planner

I am writing a 2D discrete motion planner for a task with specific instructions. The instructions for the search algorithm are contained entirely in the docstring for the ...
mmmfarrell's user avatar
4 votes
2 answers
1k views

Finding palindromic strings of even length

Given a string of digits. Find the length of longest substring of even length i.e. 0,2,... which is a palindrome or which can be rearranged to form a palindrome (see example below). Here is my code: ...
katty's user avatar
  • 615
1 vote
2 answers
5k views

Reversing the bits of a 32-bit integer

Here is my code: ...
katty's user avatar
  • 615
7 votes
4 answers
1k views

Solving jumbled letters using a given dictionary

Given a dictionary, a method to do lookup in dictionary and a M x N board where every cell has one character. Find all possible words that can be formed by a sequence of adjacent characters. Example: ...
katty's user avatar
  • 615
1 vote
1 answer
999 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 ...
katty's user avatar
  • 615
2 votes
1 answer
1k views

Project RoboNest - Nestable/Breakable For Loops + Basic While Loops for Robot Framework

I'm implementing things in Robot Framework that it does not support by default, including nestable For Loops and, now, While Loops. I'm looking for readability, algorithm, methodology, and/or ...
Brandon Olson's user avatar
1 vote
1 answer
295 views

Greedy Algorithm - Tuple Comparator

I've completed the problem set 9 of the OCW 6.00sc course which requires the implementation of a greedy algorithm - see prompt. When completing problem 2, it is asked to implement comparator ...
Teddy's user avatar
  • 131
5 votes
2 answers
1k views

Prime Number Generator (6n + 1 or 6n - 1)

This generator is like most where it brute forces an integer: it see whether the integer is divisible by any of the primes; if so, then it's not a prime and vice versa. This though only compares ...
Anthony Pham's user avatar
3 votes
2 answers
23k views

Using BFS to solve 8-puzzle game using Python 2

I'm trying to solve the 8-puzzle game using BFS, DFS and A* algorithms implemented using Python 2.7. For now, I have managed to solve a couple of test cases using BFS and I want to know how I can ...
Ramiz Rahman's user avatar

15 30 50 per page
1
2 3 4 5
11