摘要:
Given an array and a value, remove all instances of that value in place and return the new length.The order of elements can be changed. It doesn't matter what you leave beyond the new length.class Solution {public: //这个版本的快排要记住 //这个版本的Partition是 Hoare的版本 int removeElement(int A[], int n, in... 阅读全文
摘要:
Divide two integers without using multiplication, division and mod operator.class Solution {public: int divide(int dividend, int divisor) { // Start typing your C/C++ solution below // DO NOT write int main() function assert(divisor); int ans = 0, step = 1, negative = ... 阅读全文
摘要:
Given two numbers represented as strings, return multiplication of the numbers as a string.Note: The numbers can be arbitrarily large and are non-negative.class Solution {public: string add(string num1, string num2){ int i = 0, j = 0, c = 0,m = 0; string ans; while(i < num1.s... 阅读全文