|
Download cp/cp-10043.jsonl from winapiadmin/tinycodinglm: direct link, hf CLI and curl.
- Browser
- Download file 1.49 kB
-
https://huggingface.co/datasets/winapiadmin/tinycodinglm/resolve/main/cp/cp-10043.jsonl
- Command line
-
hf download hf://datasets/winapiadmin/tinycodinglm/cp/cp-10043.jsonl
-
curl -L -o cp-10043.jsonl https://huggingface.co/datasets/winapiadmin/tinycodinglm/resolve/main/cp/cp-10043.jsonl
1.49 kB
| {"type": "session", "harness": "opencode", "id": "cp-10043", "name": "LeetCode 0537: Complex Number Multiplication"} | |
| {"type": "message", "message": {"role": "system", "content": "You are an expert LeetCode problem solver. You solve problems efficiently with clean code."}} | |
| {"type": "message", "message": {"role": "user", "content": "Problem: Complex Number Multiplication (Difficulty: Medium)\nTags: Math, String, Simulation\n\nA complex number can be represented as a string on the form \"real+imaginaryi\" where:\nGiven two complex numbers num1 and num2 as strings, return a string of the complex number that represents their multiplications.\n\nExample 1:\nInput: num1 = \"1+1i\", num2 = \"1+1i\"\nOutput: \"0+2i\"\nExplanation: (1 + i) * (1 + i) = 1 + i2 + 2 * i = 2i, and you need convert it to the form of 0+2i.\n\nExample 2:\nInput: num1 = \"1+-1i\", num2 = \"1+-1i\"\nOutput: \"0+-2i\"\nExplanation: (1 - i) * (1 - i) = 1 + i2 - 2 * i = -2i, and you need convert it to the form of 0+-2i.\n\nConstraints:\n- num1 and num2 are valid complex numbers."}} | |
| {"type": "message", "message": {"role": "assistant", "content": "# Time: O(1)\n# Space: O(1)\n\nclass Solution(object):\n def complexNumberMultiply(self, a, b):\n \"\"\"\n :type a: str\n :type b: str\n :rtype: str\n \"\"\"\n ra, ia = map(int, a[:-1].split('+'))\n rb, ib = map(int, b[:-1].split('+'))\n return '%d+%di' % (ra * rb - ia * ib, ra * ib + ia * rb)\n\n"}} | |