Skip to main content

All Questions

4 votes
3 answers
144 views

Simple photomosaic generator

I wrote an implementation of Robert Heaton's Programming Exercise for Advanced Beginners #4 (photomosaics) in C99 using the MagickCore library. The full code is as follows: ...
Wilson's user avatar
  • 43
1 vote
2 answers
144 views

Function wrapper that prints the result

(English) I was recently challenged to make a simple program that does the following: Function f accepts as a parameter a function g, which returns a value. Function f must return a function h which ...
Noel's user avatar
  • 13
1 vote
2 answers
155 views

Improving Project Euler code problem #10

So, I just finished Problem 10 on Project Euler, but it took about 3 to 4 minutes for my output to come out, due to bad coding, I guess, any suggestions on how could I optimize my code? Question The ...
fabinfabinfabin's user avatar
3 votes
2 answers
699 views

Python 3 approximate pi using 9 algorithms

Note: this script requires gmpy2, if you are using Python 3.9.5 x64 on Windows 10 21H1 like me, then you need to download the pre-built ...
Ξένη Γήινος's user avatar
6 votes
2 answers
1k views

Python Place +,-, nothing between 1, 2, …, 9 (in this order) whose sum is 100

So this is a programming challenge I saw: Write a program that outputs all possibilities to put + or - or nothing between the numbers 1,2,…,9 (in this order) such that the result is 100. For example ...
Ξένη Γήινος's user avatar
3 votes
1 answer
540 views

Python script that converts Windows Registry Scripts (.reg) into PowerShell scripts (.ps1)

Well this a re-implementation of a PowerShell script that I wrote which does exactly the same thing, and I have ported it into Python. After a quick Google search I found that there is only one other ...
Ξένη Γήινος's user avatar
3 votes
1 answer
1k views

PowerShell script binary-decimal-hexadecimal-ipv4 convertor

This is a fully functional PowerShell script I wrote not long ago that converts data (numerical data) among 4 data formats: binary, decimal, hexadecimal and ipv4. It supports 12 conversions, it can ...
Ξένη Γήινος's user avatar
1 vote
2 answers
529 views

Checking the type and validity of a credit card with Luhn's algorithm in C (CS50)

I'm taking CS50 Intro to CS. In this assignment, we're asked to make a program that can identify what type of credit card (AMEX, Visa, MasterCard) is given in the input (and whether it is valid.) ...
xdxt's user avatar
  • 75
5 votes
3 answers
1k views

Printing pyramids in C (CS50)

I'm taking the CS50 course, and we're asked to create a program which takes an input (the total height of the pyramid) and outputs a pyramid of that height. i.e Here’s how the program might work if ...
xdxt's user avatar
  • 75
3 votes
2 answers
266 views

LeetCode 665: Non-decreasing Array (C)

I'm posting a solution for LeetCode's "Non-decreasing Array". If you'd like to review, please do. Thank you! Problem Given an array nums with ...
Emma's user avatar
  • 3,592
9 votes
3 answers
2k views

LeetCode 1108: Defanging an IP Address

I'm posting two solutions for LeetCode's "Defanging an IP Address". If you'd like to review, please do. Thank you! Problem Given a valid (IPv4) IP address, return a defanged version of that ...
Emma's user avatar
  • 3,592
8 votes
4 answers
477 views

Calculate sum of multiple series within array

The exercise is as follows: Player A will write list \$ a \$ consisting of \$ n \$ numbers. Player B will take a look at the paper. After that the A player will ask player B \$q\$ questions. Each ...
user229175's user avatar
3 votes
1 answer
280 views

LeetCode 146: LRU Cache III

I'm posting my Java code for LeetCode's LRU Cache. If you have time and would like to review, please do so. Thank you! Problem Design and implement a data structure for Least Recently Used (LRU) cache....
Emma's user avatar
  • 3,592
1 vote
1 answer
251 views

LeetCode 399: Evaluate Division

I'm posting my C++ code for LeetCode's Evaluate Division. If you have time and would like to review, please do so. Thank you! Problem Equations are given in the format A / B = k, where A and B are ...
Emma's user avatar
  • 3,592
1 vote
1 answer
888 views

LeetCode 809: Expressive Words

I'm posting my C++ code for LeetCode's Expressive Words. If you have time and would like to review, please do so. Thank you! Sometimes people repeat letters to represent extra feeling, such as "...
Emma's user avatar
  • 3,592

15 30 50 per page
1
2 3 4 5