a java solution


  • 0
    L

    public String complexNumberMultiply(String a, String b) {
    int m = 0,n = 0,x = 0,y = 0;
    m = Integer.parseInt(a.substring(0,a.indexOf("+")));
    n = Integer.parseInt(a.substring(a.indexOf("+")+1,a.indexOf("i")));
    x = Integer.parseInt(b.substring(0,b.indexOf("+")));
    y = Integer.parseInt(b.substring(b.indexOf("+")+1,b.indexOf("i")));
    return String.valueOf(mx-ny) + "+" + String.valueOf(my+xn) + "i";
    }
    I'm a newbie XD


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.