Starting from:

$25

ITDSIU19023- Fundamentals Of Programming: Lab 05 Solved

Create one single .c file and use functions for the questions (e.g. ex01, ex02, … for the function names)

Input a string, find the length of the longest substring without repeating characters.
Examples:

"abcabcbb", the answer is "abc", length = 3

"bbbbb", the answer is "b", length = 1

 

Input an array of integers, return indices of the two numbers such that they add up to a specific target. You may not use the same element twice.
input nums = [2, 7, 11, 15], target = 9 à return [0,1]

 

Median of a sorted array:
-          If the number of values is odd, the median is the middle value

-          If the number of values is even, the median is the average of the two middle values

Find the median of the two sorted arrays (optional: your solution should be O(log(m+n)), m n is size of two arrays)

Example:

array 1 = [1,2,5] array2 = [3,4,7,9] => [1,2,3,4,5,7,9] => median is 4

array 1 = [1,2,5,8] array2 = [3,4,7,9] => [1,2,3,4,5,7,8,9] => median is (4+5)/2 = 4.5

 

(optional) Given an integer, convert it to a roman number.
Input must be within the range from 1 to 3999.

 

More products