Agree. After failing the .co.jp sample test case I started wondering what is actually the 'domain' of a url, if not the first subdomain under the TLD? I figured there was no way I could find it from a url -- if I had used my brains a bit more I could have come up with .co.uk and maybe .co.au, but not .co.jp, and I have know idea how many of those suffixes I am unaware of...
Since I am not a pro by a long shot, I forfeited and checked the highest ranked answers, and I see that they fail for most other cases that I had covered (ftp://, subdomains, www.org).
I don't want to say Bad kata, because it did help me learn a lot, but it can certainly be improved.
Bad kata because conditions are specified unclear, and 'domain' term is specified incorrectly.
And actually there are no valid solution without using a big database of public suffix list.
Are somebody can say before googling, if alt.za, of.by, and pvt.ge are regular domains, or subdomains of alt.za, of.by, and pvt.ge are sold to an unlimited number of people by the registrars? In this, and thousands of similar cases, should we detect "alt" as domain or no?
Agree. After failing the .co.jp sample test case I started wondering what is actually the 'domain' of a url, if not the first subdomain under the TLD? I figured there was no way I could find it from a url -- if I had used my brains a bit more I could have come up with .co.uk and maybe .co.au, but not .co.jp, and I have know idea how many of those suffixes I am unaware of...
Since I am not a pro by a long shot, I forfeited and checked the highest ranked answers, and I see that they fail for most other cases that I had covered (ftp://, subdomains, www.org).
I don't want to say Bad kata, because it did help me learn a lot, but it can certainly be improved.
Exactly! I was only thinking about subdomain when answerin this kata & even that is enough to disqualify the "best practice" given :(
Bad kata because conditions are specified unclear, and 'domain' term is specified incorrectly.
And actually there are no valid solution without using a big database of public suffix list.
Are somebody can say before googling, if alt.za, of.by, and pvt.ge are regular domains, or subdomains of alt.za, of.by, and pvt.ge are sold to an unlimited number of people by the registrars? In this, and thousands of similar cases, should we detect "alt" as domain or no?
This comment is hidden because it contains spoiler information about the solution