摘要: Given a target integer T and an integer array A sorted in ascending order, find the index i in A such that A[i] is closest to T. Assumptions There can 阅读全文
posted @ 2018-12-15 18:19 fatttcat 阅读(109) 评论(0) 推荐(0)
摘要: Given a sorted (in ascending order) integer array nums of n elements and a target value, write a function to search target in nums. If targetexists, t 阅读全文
posted @ 2018-12-15 17:44 fatttcat 阅读(154) 评论(0) 推荐(0)
摘要: Write a function that reverses a string. The input string is given as an array of characters char[]. Do not allocate extra space for another array, yo 阅读全文
posted @ 2018-12-15 15:43 fatttcat 阅读(107) 评论(0) 推荐(0)
摘要: Given a linked list, swap every two adjacent nodes and return its head. Example: Note: Your algorithm should use only constant extra space. You may no 阅读全文
posted @ 2018-12-15 10:18 fatttcat 阅读(158) 评论(0) 推荐(0)
摘要: You are given two non-empty linked lists representing two non-negative integers. The most significant digit comes first and each of their nodes contai 阅读全文
posted @ 2018-12-15 08:04 fatttcat 阅读(124) 评论(0) 推荐(0)
摘要: You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contai 阅读全文
posted @ 2018-12-15 06:47 fatttcat 阅读(126) 评论(0) 推荐(0)
摘要: Reverse a linked list from position m to n. Do it in one-pass. Note: 1 ≤ m ≤ n ≤ length of list. Example: 只反转从m到n的部分链表 M1: iterative 首先找到prev的位置(开始反转位 阅读全文
posted @ 2018-12-15 03:54 fatttcat 阅读(151) 评论(0) 推荐(0)