(Hint: if the last character is not alphanumeric, put a # (a blank URL fragment) to work around HN's autodetection of punctuation)
(Edit: I don't recommend percent-encoding URLs, mainly because certain web servers react differently to percent-encoded URL, like https://www.google.com/search?q=world+dog and https://www.google.com/search?q=world%2bdog (first one is interpreted by Google search server as space, second one as a plus sign) while a blank URL fragment is guaranteed to be safe.)