Sort by

recency

|

1971 Discussions

|

  • + 0 comments

    Here is my one line Python solution! If there are less students that show up on time than the threshold, we return "YES", otherwise there are enough students and we return "NO".

    def angryProfessor(k, a):
        return "YES" if len([i for i in a if i <= 0]) < k else "NO"
    
  • + 0 comments

    c# Solution:

    public static string angryProfessor(int k, List<int> a)
    {
        return a.Count(x=> x <= 0) < k ? "YES" : "NO";
    }
    
  • + 0 comments

    someone need to fix the description in this one

  • + 0 comments

    java

    public static String angryProfessor(int k, List<Integer> a) {
            a.removeIf(n -> (n > 0));
            return a.size() < k ? "YES" : "NO";
    }
    
  • + 0 comments

    This question have some issue in its description it got me confused for a while.

    First statement:
    The first 3 students arrived on. The last 2 were late. The threshold is 3 students, so class will go on. Return YES.
    Leter statement:
    Complete the angryProfessor function in the editor below. It must return YES if class is cancelled, or NO otherwise.

    Follow the second rule if you want to successfully complete the question.