Skip to main content

All Questions

Tagged with
8 votes
2 answers
1k views

Beginner level password generator optimization

I've been learning python for a few days now, and I programmed this password generator after today's lesson (following the 100 days of code on udemy course). This code works like it should and gives ...
PSapola's user avatar
  • 83
5 votes
3 answers
909 views

Optimizing Pi Estimation Code

I'm trying to write a program in Python that estimates pi, but to get a more accurate estimation in a feasible amount of time, I want to make it faster. I'm using a method that estimates the area of ...
Rhys Bradshaw's user avatar
6 votes
8 answers
1k views

Reversing vowels in a string

Given a string s, reverse only all the vowels in the string and return it. The vowels are 'a', 'e', 'i', 'o', and 'u', and they can appear in both lower and upper ...
user avatar
4 votes
1 answer
136 views

String art program in Python using PyTorch

...
flakpm's user avatar
  • 97
5 votes
3 answers
855 views

Project Euler 127 - abc-hits

Problem (Rephrased from here): The radical of \$n\$, \$rad(n)\$, is the product of distinct prime factors of \$n\$. For example, \$504 = 2^3 × 3^2 × 7\$, so \$rad(504) = 2 × 3 × 7 = 42\$. We shall ...
Nadav Nevo's user avatar
1 vote
1 answer
269 views

Rules-engine to be improved/simplified for Efficiency (performance), Extensibility and Maintenance?

This is a simple implementation of a rules engine. I am really hating the very long MATCH/CASE function. I am wondering what kind of Design Patterns could be used there to make this code more ...
user avatar
5 votes
0 answers
83 views

Optimizing SymPy Implementation of prime factorization in form of QUBO

I'm trying to reproduce a paper on Prime Factorization. This paper converts the problem into a QUBO form, which then we can map it to an Ising Minimizer. I've basically done everything and I've ...
Amirhossein Rezaei's user avatar
3 votes
1 answer
107 views

Benchmark for loop and deque/map/methodcaller

While discussing with some colleagues, one argued that a for loop over a list of objects to call a method is a bad practice because it has bad performance compared ...
Dorian Turba's user avatar
3 votes
5 answers
1k views

How do I speed up this simulation program

This is a program to solve a differential equation numerically using Euler method. As of now, it is very slow, and I need to run 10000 Monte Carlo simulations. The differential equation is called ...
Jonathan Wick's user avatar
8 votes
3 answers
2k views

Bug Byte puzzle from Jane Street

This is a puzzle from Jane Street. Given this graph: Fill in the edge weights in the graph with the numbers 1 through 24, using each number exactly once. Labeled nodes provide some additional ...
Marc's user avatar
  • 5,604
2 votes
1 answer
132 views

Multithreaded sparse linear solver in Python

I would like to know if there are any multithreaded sparse linear solvers for LU decomposed sparse matrices. I want to increase the solving speed of a system like: ...
aqw's user avatar
  • 29
1 vote
2 answers
71 views

Using odd prime powers, my heuristic tries to solve instances of Exact 3 Cover in polytime, what can be done to optimize it?

By the way, a heuristic is not the same thing as a proven working algorithm that solves all input instances. It could either be experimental or be used to study intricacies in a problem. The purpose ...
The T's user avatar
  • 451
3 votes
1 answer
81 views

Pytorch code running slow for Deep Q learning (Reinforcement Learning)

I'm a new student in reinforcement learning. Below is the code that I wrote for deep Q learning: ...
Jahid Chowdhury Choton's user avatar
6 votes
1 answer
329 views

Codeforces: D2. Counting Is Fun (Hard Version)

The code works okay for the following problem. Problem An array 𝑏 of 𝑚 non-negative integers is said to be good if all the elements of 𝑏 can be made equal to 0 using the following operation some (...
user24714692's user avatar
2 votes
2 answers
142 views

BlackJack in python

I began creating blackjack in python; however, I'm looking to simulate it, so I'm thinking I'm going to need to optimize it so that I don't just leave my computer running for three hours waiting for ...
Joseph Beegle's user avatar

15 30 50 per page
1
2 3 4 5
157