1 / 6
May 2011

I made this tool which recommends problems based upon the problems already solved by the user. It can also be used to find problems similar to any given problem.

Problem Recommendations17

  • created

    May '11
  • last reply

    Dec '11
  • 5

    replies

  • 1.2k

    views

  • 3

    users

  • 2

    links

Maybe it should also work for challenge tasks?
For example there are no suggestions for user bords0 which solves (solved) only challenge tasks.

If I may ask, what is the algorithm for finding similar tasks?

It doesn't work for challenge problems because I have been scraping data from the plaintext history by looking for "AC"s. Thanks for pointing this out, I will try to get it fixed sometime within the next few days.

My code is available on Github, but it is a little messy right now. github.com/vikhyat/spojtool3

Basically, I get a list of problems solved by several users, and then invert this data to get a list of users who have solved each problem. Then I compute the similarity of problems. (I am using the Sørensen index currently.) For each problem, I compute the similarity with every other problem I know of and store the top few matches. (This data is in similarities.rb.) Once I have the similarities, it is quite straightforward to recommend problems:

def recommendations(user)
  scores = {}
  my_problems = solved_problems(user)
  my_problems.each do |problem|
    similar = $similarities[problem.to_sym]
    for i,j in similar # i is the problem code, j is the similarity
      next if my_problems.include? i.to_s
      scores[i] ||= 0
      scores[i] += j
    end
  end
  scores.sort_by {|k,v| v }.reverse.map {|x| x[0] }[0..19]
end

It seems that it works as it displayed me all the easiest tasks. stuck_out_tongue
One more solved, though. smile

I have fixed it, it now works for challenge problems too.

7 months later

For example there are no suggestions for user bords0 which solves (solved) only challenge tasks.