You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Explanation: We will visit "google.mail.com" 900 times, "yahoo.com" 50 times, "intel.mail.com" once and "wiki.org" 5 times. For the subdomains, we will visit "mail.com" 900 + 1 = 901 times, "com" 900 + 50 + 1 = 951 times, and "org" 5 times.
* Logic : Use built in methods split() and substring() to split domains
and remove the counted subdomain every iteration with substring()
* Runtime: 92 ms faster than 84.31%
* Memory Usage: 41.2 MB less than 70.87%
*
*/
var subdomainVisits = function (cpdomains) {
if (!cpdomains || cpdomains.length <= 0) return [];