Suppose you have to write a program which gives the quadrant of a certain point whose $x$ and $y$ coordinates are given using least lines possible
For python (you may use other programing languages too) , I made this function :
1 

Now the next task is, to use least characters to form the program.
Can you do it?
Note :
Number of characters used in the names of variables or functions will be considered as a single character.
This program will work slow for large numbers (due to multiplication operation used in it), if someone can make it short and faster it will be appreciated too.
Easy Math Editor
This discussion board is a place to discuss our Daily Challenges and the math and science related to those challenges. Explanations are more than just a solution — they should explain the steps and thinking strategies that you used to obtain the solution. Comments should further the discussion of math and science.
When posting on Brilliant:
*italics*
or_italics_
**bold**
or__bold__
paragraph 1
paragraph 2
[example link](https://brilliant.org)
> This is a quote
\(
...\)
or\[
...\]
to ensure proper formatting.2 \times 3
2^{34}
a_{i1}
\frac{2}{3}
\sqrt{2}
\sum_{i=1}^3
\sin \theta
\boxed{123}
Comments
Sort by:
Top NewestWoah! I really can't think of a different algorithm to do this, but I may have found a few tweaks to lower the character count:
Log in to reply
Log in to reply
Log in to reply
Umm... suppose you change xy/abs(xy) into x/abs(x) * y/abs(y) ,it would have less time complexity, right?
Log in to reply
@Yajat Shamji @Mahdi Raza @Aryan Sanghi @David Stiff @Jeff Giff @Vinayak Srivastava @Akela Chana @Siddharth Chakravarty
Log in to reply
Here the challenge is the number of lines. But remember if x, y is very large the multiplication might take some time, in this case, it is better to use ifelse conditions.
Log in to reply