摘要: 问题: 给定一个包含0的数组,对数组进行遇到0,则再输出一次,后续元素向后推移。 求的转换后的数组。 Example 1: Input: [1,0,2,3,0,4,5,0] Output: null Explanation: After calling your function, the inpu 阅读全文
posted @ 2020-06-20 15:59 habibah_chang 阅读(149) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定字符串s,和可进行交换的index对数组。 对字符串s的各个位置index,可根据交换数组所示的两两交换(次数不限),求进行交换后,可得最小的字符串。 Example 1: Input: s = "dcab", pairs = [[0,3],[1,2]] Output: "bacd" E 阅读全文
posted @ 2020-06-20 15:22 habibah_chang 阅读(145) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定数组arr2,所含元素唯一, 给定数组arr1,对arr1排序,使得arr1的元素相对顺序为arr2的顺序,不存在于arr2中的元素,按照升序排列。 Example 1: Input: arr1 = [2,3,1,3,2,4,6,7,9,2,19], arr2 = [2,1,4,3,9, 阅读全文
posted @ 2020-06-20 09:20 habibah_chang 阅读(160) 评论(0) 推荐(0) 编辑