[LeetCode] String to Integer (atoi)

8. String to Integer (atoi)

Implement atoi which converts a string to an integer.

The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this character takes an optional initial plus or minus sign followed by as many numerical digits as possible, and interprets them as a numerical value.

The string can contain additional characters after those that form the integral number, which are ignored and have no effect on the behavior of this function.

If the first sequence of non-whitespace characters in str is not a valid integral number, or if no such sequence exists because either str is empty or it contains only whitespace characters, no conversion is performed.

If no valid conversion could be performed, a zero value is returned.

Note:

  • Only the space character ‘ ‘ is considered a whitespace character.
  • Assume we are dealing with an environment that could only store integers within the 32-bit signed integer range: [−231, 231 − 1]. If the numerical value is out of the range of representable values, 231 − 1 or −231 is returned.
Read more
[LeetCode] ZigZag Conversion

6. ZigZag Conversion

The string “PAYPALISHIRING” is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)

1
2
3
P   A   H   N
A P L S I I G
Y I R

And then read line by line: “PAHNAPLSIIGYIR”

Write the code that will take a string and make this conversion given a number of rows:

string convert(string s, int numRows);

Read more
[LeetCode] Longest Palindromic Substring

3. Longest Palindromic Substring

Given a string s, return the longest palindromic substring in s.

Read more
[오브젝트] 역할, 책임, 협력

역할, 책임, 협력

Read more
[LeetCode] Longest Substring Without Repeating Characters

3. Longest Substring Without Repeating Characters

Given a string s, find the length of the longest substring without repeating characters.

Read more
[오브젝트] 객체지향 프로그래밍

객체지향 프로그래밍

Read more
[LeetCode] Add Two Numbers

2. AddTwoNumbers

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 contains a single digit. Add the two numbers and return the sum as a linked list.

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

Read more
[오브젝트] 객체, 설계

객체, 설계

Read more
네이버 2차 면접 후기

네이버 2차 면접 후기

Read more
네이버 1차 면접 후기

네이버 1차 면접 후기

Read more