Uber OA

2题一小时做完

  1. Perfect Substring : Count the number of substring that contain all digits exactly k times or 0 times.
    Eg: If k=2: Valid string is 001122 Invalid String is 00112
    Length of string<= 1e5
    1<=k<=1e4
  2. Hate Graphs : You are given a list of species numbered 1 to n. You have two arrays a and b. For all i, a[i] and b[i] hate each other. Find the number of ways you can keep these species in enclosures such that no pair of species who hate each other are in the same enclosure.

第二题做不来

看tag是在职跳槽

1 Like