leetcode

Solution to some Leetcode problems written in C++
git clone git://git.dimitrijedobrota.com/leetcode.git
Log | Files | Refs | README | LICENSE

0537.cpp (315B)


      1 class Solution {
      2   public:
      3     string complexNumberMultiply(const string num1, const string num2) {
      4         int a, b, c, d;
      5         char t;
      6         stringstream(num1) >> a >> t >> b;
      7         stringstream(num2) >> c >> t >> d;
      8         return to_string(a * c - b * d) + "+" + to_string(a * d + b * c) + "i";
      9     }
     10 };