Skip to content

Instantly share code, notes, and snippets.

@pmillssf
pmillssf / mergeTwoSortedLinkedLists.md
Last active December 6, 2017 03:53
Write up for how to merge two sorted linked lists

Requirements

Merge two sorted linked lists.

  • input: head of sorted linked list one, head of sorted linked list two
  • output: head of linked list containing one and two merged
  • constraints: the new list should be made by splicing together the nodes of the two lists
  • edge cases: null inputs, duplicate values

Strategy

Requirements

Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.

  • input: string, made up of '(', ')', '{', '}', '[', and ']'
  • output: boolean, if valid parentheses
  • constraints:
  • edge case: empty string

Strategy

Requirements

Given a non-negative integer represented as a non-empty array of digits, plus one to the integer.

You may assume the integer do not contain any leading zero, except the number 0 itself.

The digits are stored such that the most significant digit is at the head of the list.

  • input: array of positive integers, representing an integer
  • output: array of positive integers, representing the input integer plus one

Requirements

Given two sorted arrays, nums1 & nums2, merge nums2 into nums1 nums1 will have the indexs for nums2 pre-allocated, with values of 0 and the function arguments will include intgers m and n, where m refers to the total number of intergers in nums1, and n refers to the total number of integers in nums2 for example: nums1 = [1, 2, 3, 0, 0, 0] m = 3