`{"id":"7ee5518c-8621-4cce-8707-27d6882f0faa","name":"Multiply Strings","description":"1. Given two non-negative integers num1 and num2 represented as strings.\r\n2. Return the product of num1 and num2, also represented as a string.\r\n3. Note: You must not use any built-in BigInteger library or convert the inputs to integer directly.\r\n","inputFormat":"Input: num1 = \"123\", num2 = \"456\"\r\n","outputFormat":"Output: \"56088\"","constraints":"1. 1 &lt;= num1.length, num2.length &lt;= 200\r\n2. num1 and num2 consist of digits only.\r\n3. Both num1 and num2 do not contain any leading zero, except the number 0 itself.\r\n","sampleCode":{"cpp":{"code":"#include <iostream>\n#include <vector>\n#include <string>\n#include <cmath>\nusing namespace std;\n\nstring multiplication(string num1, string num2) {\n // write your code here\n return str;\n}\n\nint main() {\n string str1;\n string str2;\n cin>>str1;\n cin>>str2;\n string res = multiplication(str1, str2);\n cout<<res;\n return 0;\n}\n"},"java":{"code":"import java.util.*;\r\n\r\npublic class Main {\r\n\r\n // ~~~~~~~~~~~~~~~User Section~~~~~~~~~~~~\r\n public static String multiplication(String num1, String num2) {\r\n // write your code here\r\n }\r\n\r\n //~~~~~~~~~~~~Input Management~~~~~~~~~~~~~\r\n public static void main(String[] args) {\r\n Scanner scn = new Scanner(System.in);\r\n\r\n String str1 = scn.nextLine();\r\n String str2 = scn.nextLine();\r\n\r\n String res = multiplication(str1, str2);\r\n System.out.println(res);\r\n }\r\n}\r\n"},"python":{"code":""}},"points":10,"difficulty":"easy","sampleInput":"123\r\n456","sampleOutput":"56088","questionVideo":"","hints":[],"associated":[],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"35f2cfb0-6f25-4967-b0c9-92f2384b9260","name":"Arrays And Strings For Intermediate","slug":"arrays-and-strings-for-intermediate-732","type":0},{"id":"3263d1f2-bc3e-4c12-9037-bd7fec47a7de","name":"Multiply Strings","slug":"multiply-strings","type":1}],"next":{"id":"7cf5b212-4dd1-4a7a-95f7-17bdb84266d3","name":"Multiply Strings","type":3,"slug":"multiply-strings"},"prev":{"id":"9a42e807-f54a-40e8-be4c-83086332cd47","name":"Add Strings MCQ","type":0,"slug":"add-strings-mcq"}}}`

# Multiply Strings

1. Given two non-negative integers num1 and num2 represented as strings. 2. Return the product of num1 and num2, also represented as a string. 3. Note: You must not use any built-in BigInteger library or convert the inputs to integer directly.

`{"id":"7ee5518c-8621-4cce-8707-27d6882f0faa","name":"Multiply Strings","description":"1. Given two non-negative integers num1 and num2 represented as strings.\r\n2. Return the product of num1 and num2, also represented as a string.\r\n3. Note: You must not use any built-in BigInteger library or convert the inputs to integer directly.\r\n","inputFormat":"Input: num1 = \"123\", num2 = \"456\"\r\n","outputFormat":"Output: \"56088\"","constraints":"1. 1 &lt;= num1.length, num2.length &lt;= 200\r\n2. num1 and num2 consist of digits only.\r\n3. Both num1 and num2 do not contain any leading zero, except the number 0 itself.\r\n","sampleCode":{"cpp":{"code":"#include <iostream>\n#include <vector>\n#include <string>\n#include <cmath>\nusing namespace std;\n\nstring multiplication(string num1, string num2) {\n // write your code here\n return str;\n}\n\nint main() {\n string str1;\n string str2;\n cin>>str1;\n cin>>str2;\n string res = multiplication(str1, str2);\n cout<<res;\n return 0;\n}\n"},"java":{"code":"import java.util.*;\r\n\r\npublic class Main {\r\n\r\n // ~~~~~~~~~~~~~~~User Section~~~~~~~~~~~~\r\n public static String multiplication(String num1, String num2) {\r\n // write your code here\r\n }\r\n\r\n //~~~~~~~~~~~~Input Management~~~~~~~~~~~~~\r\n public static void main(String[] args) {\r\n Scanner scn = new Scanner(System.in);\r\n\r\n String str1 = scn.nextLine();\r\n String str2 = scn.nextLine();\r\n\r\n String res = multiplication(str1, str2);\r\n System.out.println(res);\r\n }\r\n}\r\n"},"python":{"code":""}},"points":10,"difficulty":"easy","sampleInput":"123\r\n456","sampleOutput":"56088","questionVideo":"","hints":[],"associated":[],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"35f2cfb0-6f25-4967-b0c9-92f2384b9260","name":"Arrays And Strings For Intermediate","slug":"arrays-and-strings-for-intermediate-732","type":0},{"id":"3263d1f2-bc3e-4c12-9037-bd7fec47a7de","name":"Multiply Strings","slug":"multiply-strings","type":1}],"next":{"id":"7cf5b212-4dd1-4a7a-95f7-17bdb84266d3","name":"Multiply Strings","type":3,"slug":"multiply-strings"},"prev":{"id":"9a42e807-f54a-40e8-be4c-83086332cd47","name":"Add Strings MCQ","type":0,"slug":"add-strings-mcq"}}}`

Editor

Loading...

# Multiply Strings

easy

1. Given two non-negative integers num1 and num2 represented as strings. 2. Return the product of num1 and num2, also represented as a string. 3. Note: You must not use any built-in BigInteger library or convert the inputs to integer directly.

## Constraints

1. 1 <= num1.length, num2.length <= 200 2. num1 and num2 consist of digits only. 3. Both num1 and num2 do not contain any leading zero, except the number 0 itself.

## Format

### Input

Input: num1 = "123", num2 = "456"

Output: "56088"

## Example

Sample Input

```.css-23h8hz{color:inherit;font-size:0.875rem;line-height:1.125rem;letter-spacing:0.016rem;font-weight:var(--chakra-fontWeights-normal);white-space:pre-wrap;}123 456```

### Sample Output

`.css-3oaykw{color:var(--chakra-colors-active-primary);font-size:0.875rem;line-height:1.125rem;letter-spacing:0.016rem;font-weight:var(--chakra-fontWeights-normal);white-space:pre-wrap;font-family:Monospace;}56088`

Discussions

Show Discussion

Related Resources