### Comparison without relational operators

**Source:**Quant interview at Religare Technova

**Problem:**Write a C program to compare two integers without using relational operators (== != < <= > >=)

Quant, Math & Computer Science Puzzles for Interview Preparation & Brain Teasing

A collection of ~225 Puzzles with Solutions (classified by difficulty and topic)

Showing posts from January, 2011

- Get link
- Google+

Let

Update (31 January 2011)

- Get link
- Google+

Given a permutation

1) There is no high funda group theory/number theory involved. I could solve this in 15 minutes \m/ \m/

2) After you are done, you might want to read this (*Spoiler Alert*)

Hint posted by Nikhil Garg (CSE, IIT Delhi third year undergraduate student) in comments! Solution posted by Kalyan in comments! Kalyan's comment explained in detail by me in comments! A simpler solution posted by Gaurav Sinha (chera) (CSE IITK 1996 Alumnus, Indian Revenue Service) in comments!

- Get link
- Google+

- Get link
- Google+

Update: (23 January 2011)

- Get link
- Google+

- Get link
- Google+

Note that we solved a similar problem and got the value of E(n,1) some time back in this problem.