加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

360. Sort Transformed Array二元一次方程返回大数序列

发布时间:2020-12-14 03:50:17 所属栏目:大数据 来源:网络整理
导读:[抄题]: Given a?sorted?array of integers? nums ?and integer values? a ,? b ?and? c . Apply a quadratic function of the form f( x ) =? ax 2?+? bx ?+? c ?to each element? x ?in the array. The returned array must be in?sorted order. Expect

[抄题]:

Given a?sorted?array of integers?nums?and integer values?a,?b?and?c. Apply a quadratic function of the form f(x) =?ax2?+?bx?+?c?to each element?x?in the array.

The returned array must be in?sorted order.

Expected time complexity:?O(n)

Example 1:

Input: nums = [-4,-2,2,4],a = 1,b = 3,c = 5 Output: [3,9,15,33] 

Example 2:

Input: nums = [-4,a = -1,b = 3,c = 5 Output: [-23,-5,1,7]

?[暴力解法]:

时间分析:

空间分析:

?[优化后]:

时间分析:

空间分析:

[奇葩输出条件]:

[奇葩corner case]:

[思维问题]:

不知道和指针对撞有啥关系:谁的平方比较大(绝对值大)数组就先加谁

[英文数据结构或算法,为什么不用别的数据结构或算法]:

[一句话思路]:

[输入量]:空:?正常情况:特大:特小:程序里处理到的特殊情况:异常情况(不合法不合理的输入):

[画图]:

[一刷]:

[二刷]:

[三刷]:

[四刷]:

[五刷]:

? [五分钟肉眼debug的结果]:

[总结]:

[复杂度]:Time complexity: O() Space complexity: O()

[算法思想:迭代/递归/分治/贪心]:

[关键模板化代码]:

[其他解法]:

[Follow Up]:

[LC给出的题目变变变]:

?[代码风格] :

?[是否头一次写此类driver funcion的代码] :

?[潜台词] :

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读