All Tracks Problem

Sorting The Houses
/

Very-Easy

Problem
Editorial
Analytics

The wizard in the SQL city got a list of house numbers in a database. Now he sorts all the house numbers and gives them a particular rank that starts from 1 based on their values in ascending order. Suppose that the house numbers are 145 , 60 and 82 then house no 60 gets rank 1 , house 82 gets rank 2 and house 145 gets rank 3.
Now the wizard has to solve a complex problem. He has to count total pairs of house numbers \((a,b)\) in the database such that they follow the following rules -

  • a is smaller than b
  • a is odd but b is even
  • rank of a is even and rank of b is odd

Input Format:

Table : houses

Field Type
house_number int

Sample:

house_number
320
121
674
415

Output:

answer
0
Explanation

There is no pair of houses that satisfies the given conditions

Time Limit: 5 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB

Best Submission

Similar Problems

Contributors

Initializing Code Editor...
Notifications
View All Notifications

?