# goldmansachs
Coderpad Questions
1. Suppose we are given a string “aaabbbbbccccdaa”, then we to print “a3b5c4d1a2”.
2. Given an array in which there are arrays that are of length two, the first index of that array has the student name and the second index has the marks scored. Find the maximum average scored by any student. The array can have multiple subjects of marks for a particular student.
3. a/b + c/d = simple form
4. grid [][] contain coins find optimal path to collect most coins (only allowed north and east)
5. Given a string ” A B A B C A B A B C D”, you have to compress it into the following format:
A B * C * D.
Here, till A B * of the output, A B repeats twice, but till A B * C *, A B A B C repeats twice. I could not solve this and went to next question.
6. Given a matrix of numbers, the task was to collect the maximum numbers possible when going from bottom left corner of the matrix to top right corner of the matrix. The only two directions you can move are up and right. I was able to solve this.
7. Given two fractions which are represented as an array of two elements (numerator and denominator), the task to find the reduced fraction which is the sum of two fractions.
8. Given two sorted arrays, find the median of them.
9. Trapping rain water problem.
10. Find minimum sub array whose sum is at least to the given target. eg: Sub array: 1, 2, 5, 6, 11, 2 Target: 12 Answer: 11, 2
11. https://leetcode.com/problems/trapping-rain-water/ (Trapping the rainwater).
12. A variant of Knapsack (0-1 )- https://www.geeksforgeeks.org/0-1-knapsack-problem-dp-10/ (She wanted the DP solution only. She was not accepting the recursive solution)
13. There are some students, sitting in a circle. Each student is assigned a roll no (1 to n). There is a teacher who was given an initial roll no and he has to remove the student with initial roll no. and then has to remove the student who was at that position starting from the removed student. Your function should return the last student left.
Example: 2, 3, 1, 4, 5 start with 3, remove 3, then remove 5, then remove 1 (follow circle), then remove 4. Ans – 2. Problem is similar to https://www.geeksforgeeks.org/josephus-problem-set-1-a-on-solution/
14. Given a list of students with their scores in different subjects find the student with a max average score.
15. Median of two sorted arrays (without extra space). Link – https://www.geeksforgeeks.org/median-two-sorted-arrays-different-sizes-ologminn-m/
16. Given a log file, each line begins with some IP address, find the most frequent IP address.
17. https://www.geeksforgeeks.org/find-minimum-element-in-a-sorted-and-rotated-array/
18. https://www.geeksforgeeks.org/median-two-sorted-arrays-different-sizes-ologminn-m/ O(n) accepted
19. https://leetcode.com/problems/string-compression/
20. https://www.geeksforgeeks.org/container-with-most-water/
21. Repeated Character Whose First Appearance is Leftmost
22. Find the first maximum length even word from a string
23. Write a function that takes input and output as shown under:-
Input (string) Output (string)
—– ——
aaa a3
aabbcc a2b2c2
aaabcdd a3b1c1d2
a a1
24. a) You are an avid rock collector who lives in southern California. Some rare and desirable rocks just became available in New York, so you are planning a cross-country road trip. There are several other rare rocks that you could pick up along the way. You have been given a grid filled with numbers, representing the number of rare rocks available in various cities across the country. Your objective is to find the optimal path from So_Cal to New_York that would allow you to accumulate the most rocks along the way.
Note: You can only travel either north (up) or east (right).
b) Consider adding some additional tests in doTestsPass().
c) Implement optimalPath() correctly.
d) Here is an example:
^
{{0, 0, 0, 0, 5}, New_York (finish) N
{0, 1, 1, 1, 0},
So_Cal (start) {2, 0, 0, 0, 0}} S
v
The total for this example would be 10 (2+0+1+1+1+0+5).
25. Given a string. Write a function to find the first non-repeating character in it. If there is no non-repeating character, return 0;
e.g.
Input (string) Output (char)
—– ——
aabbccd d
abbccddee a
iijjkkllmm 0
26. Implement a function that takes two unsigned integers as arguments namely numerator & denominator and outputs a string representing the fraction in decimal form. If there is a repeating and non-terminating digit that appears in the decimal form, write that in parenthesis.
e.g.
Input (UINT n, UINT d) Output (string)
—– ——
2, 5 0.4
1, 2 0.5
1, 3 0.(3)
12, 5 2.4
11, 20 0.55
5, 3 1.(6)
27. Repeating first index. "rahulgorai" - return r
没有合适的资源?快使用搜索试试~ 我知道了~
leetcode按行输出-goldmansachs:键盘问题
共7个文件
java:6个
md:1个
需积分: 14 1 下载量 140 浏览量
2021-06-30
06:01:30
上传
评论
收藏 6KB ZIP 举报
温馨提示
leetcode按行输出高盛 键盘问题 假设我们得到一个字符串“aaabbbbbccccdaa”,然后我们打印“a3b5c4d1a2”。 给定一个数组,其中包含长度为 2 的数组,该数组的第一个索引是学生姓名,第二个索引是评分。 找出任何学生的最高平均分。 对于特定学生,该数组可以有多个科目的分数。 a/b + c/d = 简单形式 网格 [][] 包含硬币找到收集大多数硬币的最佳路径(仅允许向北和向东) 给定一个字符串“ABABCABABCD”,你必须把它压缩成以下格式:AB * C * D。这里,直到输出的AB *,AB重复两次,但直到AB * C *,ABABC重复两次。 我无法解决这个问题并转到下一个问题。 给定一个数字矩阵,任务是收集从矩阵左下角到矩阵右上角时可能的最大数字。 您可以移动的唯一两个方向是向上和向右。 我能够解决这个问题。 给定两个分数,它们表示为由两个元素(分子和分母)组成的数组,任务是找到减少的分数,即两个分数的总和。 给定两个已排序的数组,找出它们的中位数。 截留雨水问题。 找到总和至少为给定目标的最小子数组。 例如:子数组:1, 2, 5, 6, 11,
资源详情
资源评论
资源推荐
收起资源包目录
goldmansachs-master.zip (7个子文件)
goldmansachs-master
q3.java 1KB
q1.java 1KB
q22.java 1KB
README.md 5KB
q27-hashset.java 984B
q8-mergeArray.java 1KB
q8.java 1KB
共 7 条
- 1
weixin_38586279
- 粉丝: 2
- 资源: 949
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0