[LeetCode C 实现]345. Reverse Vowels of a String

Write a function that takes a string as input and reverse only the vowels of a string.

Example 1:

Given s = "hello", return "holle".

Example 2:

Given s = "leetcode", return "leotcede".


The vowels does not include the letter "y".


[LeetCode C 实现]234. Palindrome Linked List

Given a singly linked list, determine if it is a palindrome.

Follow up:

Could you do it in O(n) time and O(1) space?

题目描述比较简单:判断链表中的val组成的数字是否是回文数即形如12321 123321即是回文数。

如果题目中没有O(1) space的要求的话,那么可以把链表的值顺序读出放在数组中,然后进行判断。




* Definition for......

[LeetCode C 实现]20. Valid Parentheses

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

An input string is valid if:

Open brackets must be closed by the same type of brackets.

Open brackets must be closed in the ......

[LeetCode C实现] 160. Intersection of Two Linked Lists

Write a program to find the node at which the intersection of two singly linked lists begins.

For example, the following two linked lists:

A: a1 → a2

c1 → c2 → c3

B: b1 → b2 → b3

begin to intersect at node c1.


If the two linked lists have no interse......

[LeetCode C 实现]38.Count and Say

The count-and-say sequence is the sequence of integers with the first five terms as following:






1 is read off as "one 1" or 11.

11 is read off as "two 1s" or 21.

21 is read off as "one 2, then one 1" or 1211.

Given an integer n, generat......



#include <stdio.h>

#include <sys/types.h>

#include <unistd.h>

int main(void)


int i;

for(i=0; i<2; i++){











[LeetCode C 实现]190. Reverse Bits

Reverse bits of a given 32 bits unsigned integer.

For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represented in binary as 00111001011110000010100101000000).

Follow up:

If this function is called many times, how would you opti......

[LeetCode C实现]292. Nim Game

You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 stones. The one who removes the last stone will be the winner. You will take the first turn to remove the stones.

Both of you are very clever and have......

[LeetCode C实现]2. Add Two Numbers

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

You may assume the two numbers do not contain any leading zero, except the numb......