(Just needed approach) q.1. Find the unique element present in array if rest all element is twice in space complexity O(1). q.2. Find majority element in space complexity O(1) if the element is more than n/2 times.
DSA CODING q.1 Removing Stars From a String
You are given a string s, which contains stars *.
In one operation, you can:
Choose a star in s. Remove the closest non-star character to its left, as well as remove the star itself. Return the string after all stars have been removed.
q.2. Reschedule Meetings for Maximum Free Time I
You are given an integer eventTime denoting the duration of an event, where the event occurs from time t = 0 to time t = eventTime.
You are also given two integer arrays startTime and endTime, each of length n. These represent the start and end time of n non-overlapping meetings, where the ith meeting occurs during the time [startTime[i], endTime[i]].
You can reschedule at most k meetings by moving their start time while maintaining the same duration, to maximize the longest continuous period of free time during the event.
The relative order of all the meetings should stay the same and they should remain non-overlapping.
Return the maximum amount of free time possible after rearranging the meetings.
Note that the meetings can not be rescheduled to a time outside the event.