Implement a graph data structure in Java and write a method to perform a depth-first search (DFS) starting from a given vertex.

Algorithms & Data Structures

Given an array of integers, find all possible subsets of the array. For example, if the input array is [1, 2, 3], the output should be [], [1], [2], [3], [1,2], [1,3], [2,3], [1,2,3].

Implement a graph data structure in Java and write a method to perform a depth-first search (DFS) starting from a given vertex.

Given two linked lists, each representing a non-negative integer (in reverse order), add the two numbers and return it as a linked list (also in reverse order). For example, given 2->4->3 and 5->6->4, return 7->0->8.