this is my code for problems five of euler project
i like to knows where is my wrong
please help me
multipation = 2
def lcm(i):
global multipation
if (multipation % i != 0):
for k in range(2, 21):
multipation *= k
if (multipation % i == 0):
...
Pep8 says --max-line-length=79 but Django says --max-line-length=119. Both are associated with Python. Even in GitHub code review it is 119. I just want something that supports python with 119 characters and formats my document automatically rather than me doing it, as it formats with autopep8 with max line length = 79 — Mohit Kumar23 secs ago
I have created a table using while loop in jsp. I need to change the background color of a column based on the status, so I use document.getElementsByName to get the value. The problem is, it only work on the column on first row, not the others.
Sorry for the ugly coding and logic, I am practical...
Task:
Write a function which returns true if a given substring is found within a given string. If the substring isn't found, then return false.
My implementation:
#!/usr/bin/env ruby
def custom_include?(string, substring)
len = substring.size
last_feasible = string.size - len
for...
This is an implementation of a dictionary (hash map) in Rust. It is loosely based on Python's dictionary implementation, using the same "random" probing and capacity/size management. Does it use too much memory or waste too many CPU cycles? Is it documented enough to be easily understood? I tried...
In what way can I improve this? Be that performance, readability, etc.
I'm thinking implementing NumPy would improve performance.
Usage: Calculate* the nth factorial of n 1s in a row.
*No need for a precise calculation. Magnitude and leading digits is enough.
Examples:
2nd factorial of 11. (11 x ...
I started to code in c++ recently and my goal is to develop games using c++. After learning basics I tried to implement my own version of snake console based game in c++ with the help of some online tutorials. I used OOP approach. I would like to hear ideas about this code and what mistakes i hav...
Based on this question:
Heaviest Stone algorithm time complexity
Problem:
We have a collection of stones, each stone has a positive integer weight.
Each turn, we choose the two heaviest stones and smash them together. Suppose the stones have weights x and y with x <= y. The result of this smash ...
I started learning programming about a year ago, starting with Python. Half a year ago, I moved onto C++ and this is my first large project with that language. Have I understood the basics of the language?
In Main.cpp:
#pragma warning(disable : 4996)
#pragma warning(disable : 4244)
#include <memory
I'm making a node.js app that scrap the follower list on Instagram. I use, for scraping, a service of scraperapi sdk
When I go on the app the reuslt is the egde[] is empty, but if I execute the same url on firefox delevoper Edition it found the edges with all the folloer
socket.on('message2', a...
I made a random maze generator that is also playable. The performance is crap and I'd like to improve it. I'll be working on this for a few more days to make it run better myself, but just thought I'd leave this here if people want to help. (Will still be active on this post)
Any and all feedback...
The Huffman-Algorithm
The Huffman-Algorithm, named after David A. Huffman who first published this algorithm in 1952, is a algorithm for lossless data compression. As most encoding-methods, the words for often used symbols are shorter than the ones for not so commonly used symbols. The algorithm ...
Looking for a most elegant way to copy dictionary type alias to original collection.
using System;
using System.Collections.Generic;
public class SmallDictionaly: Dictionary<string, JToken>
public class NestedDictionary : Dictionary<string, SmallDictionaly>
using System.Collections.Generic;
usin...
This code below converts number from decimal to fraction. I don't know if there's a better way or better methods to do this job so any advice would be appreciated.
const toFraction = (inputNumber) => {
// Only two digits after decimal point
inputNumber = inputNumber.toFixed(2);
// destruct...
I've been working on my Rust a bit and want to know how idiomatic my rust code is for the following Project Euler problem:
What is the largest prime factor of the number 600851475143 ?
I'm not looking for ways to improve efficiency or how to improve the strategy, but purely what I can improve wit...
So i have been working on this Chess project and for that i need a move generator. I wish to know if i can improve my code for the move genration for the Knight. Here is my current code;
Let me tell a few things so you can better understand it. I am using vector<vector<int>> for the main pseudo m...
I am trying to improve my coding skills and i run into a simple issue when parsing json objects to another method. I have created a class and later i am adding to this class values (when i debug there are there) however once the method below is called the client is empty.
Can you please advise wh...
Well executor is single threaded so it make sense that heavy work might use more CPU that is available to single thread. The first tool to use here is a code review. After that I'd try a thread analysis tool stackoverflow.com/questions/51218228/… and also just looking at the OS load (top or Task Manager). — markspace43 secs ago
I am writing some code that takes and returns interfaces following the patterns in Effective Java Third Edition. I understand the principle - we want to take in interfaces because in many cases we don't really care about the discrete implementation but rather just the features of this interface. ...
I have an app whose sole purpose is to seed data files and add the data to different CSVs which are zipped and exported by the user. My application controller is filled with lines that all look like this:
def export_tips
@appointments = Appointment.order('service_id')
send_data @appoint...
@Eyeslandic Since this is a how to question, it's not really clear that it would be well received on code review. Just because the code works doesn't mean it is off-topic for stack overflow. I would also ask to that if you're going to redirect someone to code review please redirect them to our help center so that their question is more appropriate. When I redirect someone to stack overflow I always provide a link to the help center so that they know what is on topic. — pacmaninbw15 secs ago
@Peter-ReinstateMonica I don't understand your point. Is your point that people shouldn't answer question on SO? Is your point that the presented solution is wrong? Is your point that c is "not usable for serious software development"? Funny how a lot of critical systems run successfully on c. It's like... there are competent programmers in this world... and ... best practices ... and ... code review and ... unit testing, integration testing, system testing and acceptance testing are a thing. — bolov15 secs ago
Wrote this program out of curiosity after initially solving the Word Chains puzzle. Explanation of puzzle in link below.
http://rubyquiz.com/quiz44.html
NWordChains#find_word_chains will take in a number as an arg and return that amount of random word chains from a given dictionary. Initialize NW...
@SᴀᴍOnᴇᴌᴀ (took me a while to understand what Mast meant, so didn't say anything earlier) IMO I think what you had was fluff, but I'd be happy for you to have left it. What you have now I think is fluff and should just be removed.
I have just written this code that takes an initial coordinate and returns a new vector depending on a user-supplied range and bearing.
The calculation of the new position is done using Complex Numbers. I am sure there are easier ways to do this, but I wanted to play around with complex numbers. ...