We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 28a4a89 commit 066175dCopy full SHA for 066175d
src/hackerrank/interview_preparation_kit/arrays/new_year_chaos.ts
@@ -28,11 +28,17 @@ export function minimumBribes(q: number[]): number {
28
}
29
30
export function minimumBribesTransform(queue: number[]): number | string {
31
+ let result: number | string = '';
32
+
33
try {
- return minimumBribes(queue);
- } catch (e) {
34
- return TOO_CHAOTIC_ERROR;
+ result = minimumBribes(queue);
35
+ } catch (err: unknown) {
36
+ if (err instanceof Error) {
37
+ result = err.message;
38
+ }
39
40
41
+ return result;
42
43
44
export default { minimumBribes, minimumBribesTransform, TOO_CHAOTIC_ERROR };
0 commit comments