Having a list of points, how do I find if they are in clockwise order? For example: point[0] = (5,0) point[1
According to Google Calculator (-13) % 64 is 51. According to Javascript (see this JSBin) it is -13. How do
I am reading this book (NLTK) and it is confusing. Entropy is defined as: Entropy is the sum of the proba
I'm trying to write a Java routine to evaluate math expressions from String values like: "5+3" "10-40" "(
This is the best algorithm I could come up. def get_primes(n): numbers = set(range(n, 1, -1)) primes
Is there a faster way than x >= start && x <= end in C or C++ to test if an integer is between t
How do I calculate distance between two GPS coordinates (using latitude and longitude)?
I have the following JavaScript syntax: var discount = Math.round(100 - (price / listprice) * 100)
Is there a benefit to using one over the other? In Python 2, they both seem to return the same results: >&
I have an array of integers. For example: array = [123,321,12389] Is there any nice way to get the sum of
Today I needed a simple algorithm for checking if a number is a power of 2. The algorithm needs to be: Simpl
I was trying various methods to implement a program that gives the digits of pi sequentially. I tried the Tayl
I can't get my head around this, which is more random? rand() OR: rand() * rand() I´m finding it a
A question I got on my last interview: Design a function f, such that: f(f(n)) == -n Where n is a 3
How do I calculate the distance between two points specified by latitude and longitude? For clarification, I&
Is this defined by the language? Is there a defined maximum? Is it different in different browsers?
In JavaScript, how do I get: The whole number of times a given integer goes into another? The remainder?
I had an interesting job interview experience a while back. The question started really easy: Q1: We have a b
I'm looking for the fastest way to determine if a long value is a perfect square (i.e. its square root is