<p>Given an integer <code>num</code>, return <em>a string representing its hexadecimal representation</em>. For negative integers, <ahref="https://en.wikipedia.org/wiki/Two%27s_complement"target="_blank">two’s complement</a> method is used.</p>
<p>All the letters in the answer string should be lowercase characters, and there should not be any leading zeros in the answer except for the zero itself.</p>
<p><strong>Note: </strong>You are not allowed to use any built-in library method to directly solve this problem.</p>