Skip to content

Commit a65c2a8

Browse files
authored
Merge pull request #46 from bhaumikmaan/fix/complexity-mismatch
Fix default complexity issue and upgraded critical dependency
2 parents 7b4cbfe + e1ec632 commit a65c2a8

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

package.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,13 @@
109109
"main": "dist-electron/main.js"
110110
}
111111
},
112-
"keywords": ["interview", "coding", "interview prep", "technical interview", "tool"],
112+
"keywords": [
113+
"interview",
114+
"coding",
115+
"interview prep",
116+
"technical interview",
117+
"tool"
118+
],
113119
"author": "Interview Coder Contributors",
114120
"license": "AGPL-3.0-or-later",
115121
"description": "An invisible desktop application to help you pass your technical interviews.",
@@ -170,7 +176,7 @@
170176
"rimraf": "^6.0.1",
171177
"tailwindcss": "^3.4.15",
172178
"typescript": "^5.4.2",
173-
"vite": "^5.1.6",
179+
"vite": "^6.2.5",
174180
"vite-plugin-electron": "^0.28.4",
175181
"vite-plugin-electron-renderer": "^0.14.6",
176182
"wait-on": "^7.2.0"
@@ -187,4 +193,4 @@
187193
"last 1 safari version"
188194
]
189195
}
190-
}
196+
}

src/_pages/Solutions.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,15 +114,19 @@ export const ComplexitySection = ({
114114
}) => {
115115
// Helper to ensure we have proper complexity values
116116
const formatComplexity = (complexity: string | null): string => {
117-
if (!complexity) return "O(n) - Linear time/space complexity";
118-
117+
// Default if no complexity returned by LLM
118+
if (!complexity || complexity.trim() === "") {
119+
return "Complexity not available";
120+
}
121+
122+
const bigORegex = /O\([^)]+\)/i;
119123
// Return the complexity as is if it already has Big O notation
120-
if (complexity.match(/O\([^)]+\)/i)) {
124+
if (bigORegex.test(complexity)) {
121125
return complexity;
122126
}
123127

124-
// Otherwise, add a default Big O
125-
return `O(n) - ${complexity}`;
128+
// Concat Big O notation to the complexity
129+
return `O(${complexity})`;
126130
};
127131

128132
const formattedTimeComplexity = formatComplexity(timeComplexity);

0 commit comments

Comments
 (0)