Input: DataFrame employees
+---------+--------+| name | salary |+---------+--------+| Jack |19666|| Piper |74754|| Mia |62509|| Ulysses |54866|+---------+--------+Output: +---------+--------+| name | salary |+---------+--------+| Jack |39332|| Piper |149508|| Mia |125018|| Ulysses |109732|+---------+--------+Explanation: Every salary has been doubled.## Solution
### Method 1โ Direct Column Update
#### Intuition
The simplest way to double every salary is to directly update the `salary` column by multiplying its value by 2. This can be done efficiently in SQL or pandas with a single statement.#### Approach
1. Use an UPDATE statement in SQL to multiply the `salary` column by 2for all rows.2. In pandas, use vectorized assignment to update the column in one line.3. The operation is performed in-place, so no extra space is needed except for the result.#### Code
#### Complexity
*โฐ Time complexity:`O(n)`โ Each row's salary is updated once.*๐งบ Space complexity:`O(1)`โ The update isin-place, no extra space is used.