Fix default complexity issue and upgraded critical dependency

main
bhaumikmaan 2 years ago
parent 62dcb536ac
commit e1ec632ffe

@ -109,7 +109,13 @@
"main": "dist-electron/main.js" "main": "dist-electron/main.js"
} }
}, },
"keywords": ["interview", "coding", "interview prep", "technical interview", "tool"], "keywords": [
"interview",
"coding",
"interview prep",
"technical interview",
"tool"
],
"author": "Interview Coder Contributors", "author": "Interview Coder Contributors",
"license": "AGPL-3.0-or-later", "license": "AGPL-3.0-or-later",
"description": "An invisible desktop application to help you pass your technical interviews.", "description": "An invisible desktop application to help you pass your technical interviews.",
@ -170,7 +176,7 @@
"rimraf": "^6.0.1", "rimraf": "^6.0.1",
"tailwindcss": "^3.4.15", "tailwindcss": "^3.4.15",
"typescript": "^5.4.2", "typescript": "^5.4.2",
"vite": "^5.1.6", "vite": "^6.2.5",
"vite-plugin-electron": "^0.28.4", "vite-plugin-electron": "^0.28.4",
"vite-plugin-electron-renderer": "^0.14.6", "vite-plugin-electron-renderer": "^0.14.6",
"wait-on": "^7.2.0" "wait-on": "^7.2.0"

@ -95,15 +95,19 @@ export const ComplexitySection = ({
}) => { }) => {
// Helper to ensure we have proper complexity values // Helper to ensure we have proper complexity values
const formatComplexity = (complexity: string | null): string => { const formatComplexity = (complexity: string | null): string => {
if (!complexity) return "O(n) - Linear time/space complexity"; // Default if no complexity returned by LLM
if (!complexity || complexity.trim() === "") {
return "Complexity not available";
}
const bigORegex = /O\([^)]+\)/i;
// Return the complexity as is if it already has Big O notation // Return the complexity as is if it already has Big O notation
if (complexity.match(/O\([^)]+\)/i)) { if (bigORegex.test(complexity)) {
return complexity; return complexity;
} }
// Otherwise, add a default Big O // Concat Big O notation to the complexity
return `O(n) - ${complexity}`; return `O(${complexity})`;
}; };
const formattedTimeComplexity = formatComplexity(timeComplexity); const formattedTimeComplexity = formatComplexity(timeComplexity);

Loading…
Cancel
Save