views:

118

answers:

2

What does scoring an array of strings means? Does it mean checking for repeat count of every element?

A: 
Func<string, int> scoringFunction;

this is scoring function, you will get it in the constructor, they did not said how it should score strings

public class MyClass
{
    public void NextString(); // i really don't know what this function is supposed to do
    {
        string input = Console.ReadLine();
        // maybe check here if _filter(input) == true
        MyStrings.Add(input);
    }

    public List<string> MyStrings = new List<string>();

    private int _n;
    private Func<string, bool> _filter
    private Func<string, int> _score

    public MyClass(int n, Func<string, bool> filter, Func<string, int> score)
    {
        _n = n;
        _filter = filter;
        _score = score;
    }

    public IEnumerable<string> DoScoring()
    {
        return MyString.Where(_filter).OrderBy(_score).Take(_n);
    }
}

of course this is very slow (and they said they will have "very large number" of strings)

Kikaimaru
I guess we need to use Relection API (IMO) to call validate and scoring functions.
why? edited....
Kikaimaru
I guess NextString supposed to call Validate/filter function and if it returns true then it need to call Score function
that sounds possible, but what thould N mean?
Kikaimaru
I guess N used to retrieve top N results of top scoring strings
A: 

Someone on this forum: http://www.webdeveloper.com/forum/showthread.php?t=194986 has the same opinion as you. Score (an array) is counting how many times each value appears.

helios